RedisCache class

Distributed cache that stores values in Redis in-memory database.

Configuration parameters

  • connection(s):
  • discovery_key: (optional) a key to retrieve the connection from IDiscovery
  • host: host name or IP address
  • port: port number
  • uri: resource URI or connection string with all parameters in it
  • credential(s):
  • store_key: key to retrieve parameters from credential store
  • username: user name (currently is not used)
  • password: user password
  • options:
  • retries: number of retries (default: 3)
  • timeout: default caching timeout in milliseconds (default: 1 minute)
  • max_size: maximum number of values stored in this cache (default: 1000)

References

  • :discovery::*:1.0 (optional) IDiscovery services to resolve connection
  • :credential-store::*:1.0 (optional) Credential stores to resolve credential

Example

var cache = RedisCache(); cache.configure(ConfigParams.fromTuples( "host", "localhost", "port", 6379 ));

await cache.open("123"); ...

await cache.store("123", "key1", "ABC"); var value = await cache.retrieve("123", "key1"); // Result: "ABC"

Constructors

RedisCache()
Creates a new instance of this cache.

Properties

hashCode → int
The hash code for this object. [...]
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited

Methods

close(String correlationId) → Future
Closes component and frees used resources. [...]
configure(ConfigParams config) → void
Configures component by passing configuration parameters. [...]
isOpen() → bool
Checks if the component is opened. [...]
open(String correlationId) → Future
Opens the component. [...]
remove(String correlationId String key) → Future
Removes a value from the cache by its key. [...]
retrieve(String correlationId String key) → Future
Retrieves cached value from the cache using its key. If value is missing in the cache or expired it returns null. [...]
setReferences(IReferences references) → void
Sets references to dependent components. [...]
store(String correlationId, String key, dynamic value, int timeout) → Future
Stores value in the cache with expiration time. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() → String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) → bool
The equality operator. [...]
inherited