Documentation

LeanRedis.Cache.Defs

structure LeanRedis.Cache (τ : Type) :

Cache Aside pattern with a Redis backend. When a cache miss occurs, we fetch from the source callback and store it in Redis. Cache Stampete prevention with inflight request detection.

Instances For

    Simple Inflight Status of a key

    • hit: The value is cached
    • missInflight: The value is not cached, but a request to retrieve it is pending
    • miss: The value is not cached, we need to create a request to retrieve it
    Instances For

      Options for CacheSWR operations.

      • staleTtl: seconds after which a cached value is considered stale
      • ttl: optional overall Redis key TTL for eviction (default: staleTtl * 2)
      Instances For
        Equations
        Instances For
          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            structure LeanRedis.CacheSWR (τ : Type) :

            Cache Aside pattern with a Redis backend with stale while revalidate. When a cache stale occurs, we return the stale value and fetch from the source callback in the background. When a cache miss occurs, we fetch from the source callback and store it in Redis. Cache Stampete prevention with inflight request detection.

            Instances For

              Advanced Status for stale while revalidate pattern.

              • hit: The value is cached and fresh
              • stale: The value is cached but stale, we need to refresh it with the given promise
              • staleInflight: The value is cached but stale, and a refresh is already in flight
              • missInflight: The value is not cached, but a request to retrieve it is pending
              • miss: The value is not cached, we need to create a request to retrieve it
              Instances For