DVDistributedCacheAdapter class

Spreads keys across several cache nodes.

Implemented types
Available extensions

Constructors

DVDistributedCacheAdapter({required Map<String, DVCacheAdapter> nodes, int replicas = 1})

Properties

hashCode → int
The hash code for this object.
no setterinherited
nodes → Map<String, DVCacheAdapter>
The nodes, by a stable name. The name is what placement hashes, so it must not change when a host is replaced or every key moves.
final
replicas → int
How many nodes hold each key. One is a plain shard; more trades memory for surviving a node loss without losing those keys.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

clear() → Future<void>
override
delete(String key) → Future<void>
Removes key. Named as DV.Cache.delete is, so the adapter and the call an application makes say the same thing.
override
increment(String key, {int by = 1, Duration? ttl}) → Future<int>
Adds by to the number at key and returns the new total, creating it at by when it is absent.
override
nodesFor(String key) → List<String>
The nodes holding key, best first.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
purgeExpired() → Future<int>
Removes expired entries. Reads already ignore them; this reclaims space.
override
read(String key) → Future<Object?>
override
remove(String key) → Future<void>

Available on DVCacheAdapter, provided by the DVCacheAdapterRemove extension

toString() → String
A string representation of this object.
inherited
write(String key, Object? value, Duration? ttl) → Future<void>
override
writeIfAbsent(String key, Object? value, Duration? ttl) → Future<bool>
Writes only when key is absent. Returns whether the write happened.
override

Operators

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