Key features of dogpile.cache
mainThe dogpile.cache library provides several advanced caching capabilities:
- Region-based Configuration: Encourages defining "regions" upfront. Each region encapsulates a storage backend, specific configuration options, and a default expiration time.
- Standard & Decorator APIs: Provides a standard
get/set/deleteAPI as well as a function decorator API for easy integration. - Customizable Key Generation:
- Key Generators: Pluggable components used with the decorator API to determine how function arguments map to cache keys.
- Key Manglers: Pluggable components for transforming keys (e.g., encoding or SHA-1 hashing) per region.
- Distributed Locking: Backends can implement their own distributed locks tailored to their storage engine (e.g., Memcached backends use Memcached itself for coordination, while
anydbmuses lockfiles). If a backend does not provide a distributed lock,dogpiledefaults to a standard thread mutex. - Extensible Backend System: New backends can be implemented by providing
get,set, anddeletemethods. They can be registered directly or viasetuptoolsentry points.