View Source Carve.Cache (Carve v0.5.0)
Request-scoped cache for Carve to prevent redundant data fetching within a single render. Each render operation gets its own isolated cache keyed by a unique ref. TTL defaults to 500ms. Increase if requests involve slow queries. The cache is cleared at end of each render regardless of TTL.
Configuration:
config :carve, Carve.Config,
enable_cache: false,
cache_ttl: 100
Summary
Functions
Clears the cache context from the process dictionary.
Fetches a value from cache or executes the function if not cached. If caching is disabled, always executes the function.
Gets the current cache key from the process dictionary, or creates a new one. Returns nil if caching is disabled.
Creates a new cache context for a render operation. Returns a cache key that should be passed through the render pipeline.
Functions
Clears the cache context from the process dictionary.
Fetches a value from cache or executes the function if not cached. If caching is disabled, always executes the function.
Gets the current cache key from the process dictionary, or creates a new one. Returns nil if caching is disabled.
Creates a new cache context for a render operation. Returns a cache key that should be passed through the render pipeline.