@absolunet/ioc2.1.0

View on GitHub

Driver

Abstract cache driver class that defined all the abstract methods to be implemented for a cache manager driver.

Extends

Members

(static) dependencies :Array.<string>

Source:
Class dependencies: ['driver.config', 'helper.date'].

config :object.<string, *>

Source:
Current driver configuration data.

engine :*

Source:
Inherited From:
Current engine accessor.

Methods

(abstract) get(key, defaultValueopt)

Source:
Retrieve an item from the cache by key.
Parameters:
Name Type Attributes Description
key string The cache key.
defaultValue * <optional>
The default value.
Returns:
The cached value.
Type
Promise.<*>

(async, abstract) put(key, value, secondsopt)

Source:
Insert an item in the cache with key and expiration delay.
Parameters:
Name Type Attributes Description
key string The cache key.
value * The value to cache.
seconds number <optional>
The cache expiration delay, in seconds.
Returns:
The async process promise.
Type
Promise

(async, abstract) forever(key, value)

Source:
Insert an item in the cache with key forever, without expiration.
Parameters:
Name Type Description
key string The cache key.
value * The value to cache.
Returns:
The async process promise.
Type
Promise

(async, abstract) increment(key, incrementopt)

Source:
Increment an item in cache.
Parameters:
Name Type Attributes Default Description
key string The cache key.
increment number <optional>
1 The increment value to add to the cached entry.
Returns:
The async process promise.
Type
Promise

(async, abstract) decrement(key, decrementopt)

Source:
Decrement an item in cache.
Parameters:
Name Type Attributes Default Description
key string The cache key.
decrement number <optional>
1 The decrement value to substract from the cached entry.
Returns:
The async process promise.
Type
Promise

(async, abstract) delete(key)

Source:
Delete an item in the cache by key.
Parameters:
Name Type Description
key string The cache key.
Returns:
The async process promise.
Type
Promise

(async, abstract) flush()

Source:
Delete all items the cache.
Returns:
The async process promise.
Type
Promise

now()

Source:
Get current time in seconds.
Returns:
The current unix timestamp.
Type
number

setEngine(engine)

Source:
Inherited From:
Set current engine.
Parameters:
Name Type Description
engine * The engine instance.
Returns:
The current instance.
Type
support.mixins.HasEngine