Skip to content

Implement query result caching #7

@quinnjr

Description

@quinnjr

Description

Add optional query result caching to improve performance for frequently accessed data.

Tasks

  • Design cache interface trait
  • Implement in-memory cache (LRU)
  • Add Redis cache support
  • Create cache middleware
  • Add cache invalidation strategies
  • Support TTL and manual invalidation
  • Add cache statistics to metrics

Example Usage

let client = PraxClient::new(config)
    .with_cache(RedisCache::new(redis_url))
    .cache_ttl(Duration::from_secs(300));

// Cached query
let users = client.user()
    .find_many()
    .cache("active_users", Duration::from_secs(60))
    .exec().await?;

// Invalidate
client.cache().invalidate("active_users").await?;

Acceptance Criteria

  • In-memory cache works
  • Redis cache works
  • Cache invalidation on writes
  • Configurable TTL

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions