CacheManager class
The CacheManager class is responsible for managing multiple cache stores.
It allows registering, retrieving, and resolving cache stores based on their configurations.
Constructors
- CacheManager({EventManager? events, String prefix = '', Container? container})
- Creates a CacheManager instance.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- prefix → String
-
The current global prefix applied to all cache keys.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
storeNames
→ List<
String> -
A list of the names of all registered cache store configurations.
no setter
Methods
-
attachEventManager(
EventManager eventManager) → void - Attaches an EventManager so repositories can publish cache events.
-
getDefaultDriver(
) → String - Retrieves the name of the default driver for this CacheManager.
-
hasStore(
String name) → bool -
Whether a configuration exists for the cache store
name. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerStore(
String name, Map< String, dynamic> config, {Repository? repository}) → void -
Registers a new cache store configuration under the given
name. -
registerStoreFactory(
String driver, StoreFactory factory) → void - Allows registering custom StoreFactory instances for new drivers.
-
resolve(
String name) → Repository -
Builds a Repository instance from the configuration of the store
name. -
setPrefix(
String prefix) → void - Sets a new global prefix for all cache keys.
-
store(
String name) → Repository -
Retrieves the Repository for the given store
name. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
-
registeredDrivers
→ List<
String> -
A list of all known driver identifiers, including built-in drivers.
no setter
Static Methods
-
driverDocumentation(
{required String pathBase}) → List< ConfigDocEntry> - Retrieves the configuration documentation for all registered drivers.
-
registerDriver(
String driver, StoreFactoryBuilder builder, {CacheDriverDocBuilder? documentation, bool overrideExisting = true, DriverConfigBuilder? configBuilder, DriverConfigValidator? validator, List< String> requiresConfig = const []}) → void - Registers a cache driver globally so future managers can resolve it.
-
unregisterDriver(
String driver) → void - Removes a previously registered global cache driver.