The add method adds a key with given value when key doesn't exists.
Optionalsettings: CacheWriteSettingsOptionaljitter?: numberRandom jitter factor (0-1) to add variance to expiration times. Prevents thundering herd problems when many entries expire simultaneously. A value of 0.1 adds ±10% randomness to the TTL.
Optionalttl?: ITimeSpan | nullTime-to-live (TTL) duration for cached entries.
When set, entries will automatically expire after this duration.
Pass null to cache entries without automatic expiration.
Returns true when key doesn't exists otherwise false will be returned.
The addOrFail method adds a key with given value when key doesn't exists.
Throws an error if the key exists.
Optionalsettings: CacheWriteSettingsThe decrement method decrements the given key with given value.
An error will thrown if the value is not a number.
Optionalvalue: Extract<TType, number>If not defined then it will be defaulted to 1.
Returns true if the key where decremented otherwise false will be returned.
The decrementOrFail method decrements the given key with given value.
An error will thrown if the value is not a number or if the key is not found.
Optionalvalue: Extract<TType, number>If not defined then it will be defaulted to 1.
The getOrAdd method will retrieve the given key if found otherwise valueToAdd will be added and returned.
can be regular value, sync or async Invokable value and Promise | Promise value.
Optionalsettings: GetOrAddSettingsThe increment method increments the given key with given value.
An error will thrown if the value is not a number.
Optionalvalue: Extract<TType, number>If not defined then it will be defaulted to 1.
Returns true if the key where incremented otherwise false will be returned.
The incrementOrFail method increments the given key with given value.
An error will thrown if the value is not a number or if the key is not found.
Optionalvalue: Extract<TType, number>If not defined then it will be defaulted to 1.
The put methods upsert the given key and replaces the ttl when updated.
Optionalsettings: CacheWriteSettingsOptionaljitter?: numberRandom jitter factor (0-1) to add variance to expiration times. Prevents thundering herd problems when many entries expire simultaneously. A value of 0.1 adds ±10% randomness to the TTL.
Optionalttl?: ITimeSpan | nullTime-to-live (TTL) duration for cached entries.
When set, entries will automatically expire after this duration.
Pass null to cache entries without automatic expiration.
Returns true if the key where replaced otherwise false is returned.
The removeMany method removes many keys.
The param items can be a string or an Iterable of strings.
If the param items are an Iterable, it will be joined into a single string.
Think of an Iterable as representing a path.
Returns true if one of the keys where deleted otherwise false is returned.
The
ICacheBasecontract defines a way for storing and reading as key-value pairs independent of data storage.IMPORT_PATH:
"@daiso-tech/core/cache/contracts"