MemoryStore<T> class
An in-memory implementation of Store that supports tagging.
MemoryStore keeps all cached data in a local Map, making it fast but volatile. Data is lost when the store instance is garbage collected or the application terminates.
This implementation also supports tag-based operations through TaggableStore, enabling grouped cache invalidation.
For shared storage across multiple Syncache instances, consider using SharedMemoryStore instead.
Example:
final cache = Syncache<User>(
store: MemoryStore<User>(),
);
See also:
- SharedMemoryStore for namespace-based shared storage
- Store for the abstract storage interface
- TaggableStore for tag-based operations
- Implemented types
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clear(
) → Future< void> -
Clears all entries from the store.
override
-
delete(
String key) → Future< void> -
Deletes the entry for the given
key.override -
deleteByPattern(
String pattern) → Future< void> -
Deletes entries where the key matches the given glob
pattern.override -
deleteByTag(
String tag) → Future< void> -
Deletes all entries with the given
tag.override -
deleteByTags(
List< String> tags, {bool matchAll = false}) → Future<void> -
Deletes entries that have all of the specified
tags.override -
getKeysByPattern(
String pattern) → Future< List< String> > -
Returns all keys that match the given glob
pattern.override -
getKeysByTag(
String tag) → Future< List< String> > -
Returns all keys that have the given
tag.override -
getTags(
String key) → Future< List< String> > -
Returns the tags associated with a
key.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
read(
String key) → Future< Stored< T> ?> -
Reads a cached entry for the given
key.override -
toString(
) → String -
A string representation of this object.
inherited
-
write(
String key, Stored< T> entry) → Future<void> -
Writes a Stored entry to the cache with the given
key.override -
writeWithTags(
String key, Stored< T> entry, List<String> tags) → Future<void> -
Writes a Stored entry to the cache with the given
keyand optionaltags.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited