DVRedisCacheAdapter class

DV.Cache on Redis (or Valkey).

Values are JSON-wrapped the way DVDatabaseCacheAdapter wraps them, so the two adapters are interchangeable. Redis expires keys natively: purgeExpired therefore has nothing to reclaim and reports zero.

Implemented types
Available extensions

Constructors

DVRedisCacheAdapter(DVRedisClient client, {String keyPrefix = 'dartvel:'})

Properties

client → DVRedisClient
final
hashCode → int
The hash code for this object.
no setterinherited
keyPrefix → String
Prefix isolating this application's keys in a shared Redis.
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
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

Static Methods

connect(String url, {String keyPrefix = 'dartvel:', DVRedisConnect? connector}) → Future<DVRedisCacheAdapter>
Connects to the Redis at url, redis://[[user]:password@]host[:port][/database], authenticating and selecting the database the url names.