RedisStore class
Implements cache storage and locking using a Redis server.
Values are encoded with a small type prefix so strings, numbers, booleans, null, and JSON-compatible objects can share one Redis keyspace. The store connects lazily on first use and reconnects after a command failure.
- Inheritance
-
- Object
- TaggableStore
- RedisStore
- Implemented types
Constructors
Properties
- db → int?
-
Optional Redis database number.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- host → String
-
Redis hostname or address.
final
- password → String?
-
Optional Redis password.
final
- port → int
-
Redis TCP port.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
acquireLock(
String name, String owner, int seconds) → Future< bool> -
Acquires
nameforownerwith a lifetime ofseconds. -
add(
String key, dynamic value, int seconds) → Future< bool> -
Atomically stores
valueonly whenkeyis absent.override -
decrement(
String key, [dynamic value = 1]) → Future -
Decrements the integer value at
keywhile preserving its Redis TTL.override -
flush(
) → Future< bool> -
Flushes the selected Redis database.
override
-
forceReleaseLock(
String name) → void -
Removes
namewithout checking its owner. -
forever(
String key, dynamic value) → Future< bool> -
Stores
valuewithout an expiration.override -
forget(
String key) → Future< bool> -
Deletes
keyand reports whether Redis removed an entry.override -
get(
String key) → Future -
Returns and decodes the value stored at
key.override -
getAllKeys(
) → Future< List< String> > -
Scans Redis for keys in the selected database.
override
-
getPrefix(
) → String -
Returns the empty key prefix used by this store.
override
-
increment(
String key, [dynamic value = 1]) → Future -
Increments the integer value at
keywhile preserving its Redis TTL.override -
lock(
String name, [int seconds = 0, String? owner]) → Future< Lock> -
Creates a Redis-backed lock handle for
name.override -
lockOwner(
String name) → Future< String?> -
Returns the current owner of
name, if it is locked. -
many(
List< String> keys) → Future<Map< String, dynamic> > -
Returns decoded values for
keys, usingnullfor misses.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
put(
String key, dynamic value, int seconds) → Future< bool> -
Encodes and stores
valueatkey, optionally expiring it afterseconds.override -
putMany(
Map< String, dynamic> values, int seconds) → Future<bool> -
Writes each entry in
valueswith the same TTL.override -
releaseLock(
String name, String owner) → Future< bool> -
Releases
nameonly when it is owned byowner. -
restoreLock(
String name, String owner) → Future< Lock> -
Restores a Redis lock handle for an existing
owner.override -
Creates a
TaggedCacheinstance with the specified tags.inherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited