CacheConfig class

Global configuration for the entire cache system.

A CacheConfig defines system-wide defaults such as TTL, size limits, encryption settings, and memory-cache behavior. Pass an instance to the cache manager at initialization; individual endpoints can still override specific values through CachePolicy.

Constructors

CacheConfig({int defaultTtlSeconds = 300, int maxEntries = 500, int maxSizeBytes = 0, bool encrypt = false, String? encryptionKey, bool enableLogging = false, String boxName = 'flutter_api_cache', bool useMemoryCache = true, int maxMemoryEntries = 100})
Creates a new CacheConfig with the given settings.
const

Properties

boxName → String
The Hive box name used for persistent disk storage.
final
defaultTtlSeconds → int
Default time-to-live in seconds applied to all cached entries when no specific CachePolicy overrides it.
final
enableLogging → bool
Whether to log cache operations (store, retrieve, evict) to the console for debugging purposes.
final
encrypt → bool
Whether to encrypt cached data before storing it on disk.
final
encryptionKey → String?
The encryption key used when encrypt is true.
final
hashCode → int
The hash code for this object.
no setterinherited
maxEntries → int
Maximum number of entries allowed in the cache.
final
maxMemoryEntries → int
Maximum number of entries to keep in the in-memory LRU cache.
final
maxSizeBytes → int
Maximum total cache size in bytes.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
useMemoryCache → bool
Whether to enable a dual-layer caching system with both an in-memory LRU cache and disk cache for faster access.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited