TaggedCache class
A Repository whose keys are scoped by a TagSet namespace.
Every key is scoped by the current tag namespace, so entries written under one set of tag IDs are never visible to a different set, and resetting or flushing a tag (which changes the namespace) invalidates previously cached values for that tag.
- Implemented types
Constructors
- TaggedCache(Store store, TagSet tags)
-
Creates a new instance of TaggedCache with the given
storeandtags.
Properties
Methods
-
add(
String key, dynamic value, [Duration? ttl]) → Future< bool> -
Stores an item in the cache if the key does not exist.
override
-
decrement(
String key, [dynamic value = 1]) → Future -
Decrements the value of an item in the cache.
override
-
forever(
String key, dynamic value) → Future< bool> -
Stores an item in the cache indefinitely.
override
-
forget(
String key) → Future< bool> -
Removes an item from the cache.
override
-
get(
String key) → Future -
Returns the value for
keyin the current tag namespace, ornull.override -
getStore(
) → Store -
Returns the underlying store used by this tagged repository.
override
-
getTags(
) → TagSet - Returns the tag set that determines this repository's namespace.
-
increment(
String key, [dynamic value = 1]) → Future -
Increments the value of an item in the cache.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pull(
dynamic key, [dynamic defaultValue]) → Future -
Retrieves an item from the cache and deletes it.
override
-
put(
String key, dynamic value, [Duration? ttl]) → Future< bool> -
Stores an item in the cache.
override
-
remember(
String key, dynamic ttl, Function callback) → Future -
Gets an item from the cache, or executes the given
callbackand stores the result.override -
rememberForever(
String key, Function callback) → Future -
Gets an item from the cache, or executes the given
callbackand stores the result forever.override -
sear(
String key, Function callback) → Future -
Gets an item from the cache, or executes the given
callbackand stores the result forever.override -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited