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 store and tags.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
store → Store
The underlying store used for caching.
final
tags → TagSet
The set of tags associated with the cache.
final

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 key in the current tag namespace, or null.
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 callback and stores the result.
override
rememberForever(String key, Function callback) → Future
Gets an item from the cache, or executes the given callback and stores the result forever.
override
sear(String key, Function callback) → Future
Gets an item from the cache, or executes the given callback and stores the result forever.
override
toString() → String
A string representation of this object.
inherited

Operators

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