Skip to main content

Crate djangors_cache

Crate djangors_cache 

Source
Expand description

Raw-byte caches, common backends, and explicitly opted-in response caching.

This crate provides a unified interface for key-value caching:

  • Cache: The core trait defining raw-byte get, set, and delete operations.
  • CacheExt: Extension trait providing higher-level helpers like get_or_set and JSON serialization/deserialization.
  • Implementations:
    • InMemoryCache: Fast in-memory backend using Moka cache.
    • DatabaseCache: SQL-database-backed cache using djangors_cache_entries table.
    • RedisCache: Distributed backend powered by Redis.
  • Tower Middleware: CacheLayer and CacheService intercept GET requests, serving and caching responses explicitly marked with the CacheableResponse extension.

Structs§

CacheLayer
Tower middleware layer for caching responses marked with CacheableResponse.
CacheService
Tower service middleware that intercepts GET requests and serves/caches responses.
CacheableResponse
Request/response extension marker indicating that a response is cacheable by CacheLayer.
DatabaseCache
A database-backed cache backend storing entries in djangors_cache_entries.
InMemoryCache
An in-memory cache backend powered by Moka.

Enums§

CacheError
Errors encountered during cache access or value serialization.

Traits§

Cache
An object-safe cache of raw byte values.
CacheExt
Extension trait providing convenient get_or_set helpers on any Cache.

Functions§

get_or_set_fragment
Helper function to retrieve or compute a template fragment or raw byte cache entry.