The add method adds a key with given value when key doesn't exists. Returns true when key doesn't exists otherwise false will be returned. You can provide a ttl value. If null is passed, the item will not expire.
The addMany method adds new keys. Returns true for the keys that where added otherwise false will be returned.
The clear method removes all the keys in the cache.
The decrement method will decrement the given key if found otherwise nonthing will occur. Returns true if key exists otherwise false will be returned. An error will thrown if the key is not a number.
Optional
value: Extract<TType, number>TypeCacheError An error will thrown if the key is not a number.
The exists method returns true when key is found otherwise false will be returned.
The existsMany method returns true for the keys that are found otherwise false will be returned.
The get method returns the value when key is found otherwise null will be returned.
The getAndRemove method removes the given key and returns it when found otherwise null will be returned.
The getMany returns the value for the keys that are found otherwise null will be returned.
The getOr method returns the value when key is found otherwise defaultValue will be returned.
The getOrAdd method will retrieve the given key if found otherwise valueToAdd will be added and returned.
Optional
ttl: null | TimeSpanThe getOrFail method returns the value when key is found otherwise an error will be thrown.
The getOrMany method returns the value for the keys that are found otherwise defaultValue will be returned.
The increment method will increment the given key if found otherwise nonthing will occur. Returns true if key is incremented otherwise false will be returned. An error will thrown if the key is not a number.
Optional
value: Extract<TType, number>The missing method returns true when key is not found otherwise false will be returned.
The missingMany method returns true for the keys that are not found otherwise false will be returned.
The put method replaces a key if the key exists including the ttl value or adds key that do not exists with a given ttl. Returns true if the key where replaced otherwise false is returned. You must provide a ttl value. If null is passed, the item will not expire.
The putMany method replaces the keys that exists including their ttl values or adds keys that do not exists. Returns true for all the keys that where replaced otherwise false is returned.
The remove method removes the given key when found. Returns true if the key is found otherwise false is returned.
The removeMany method removes keys. Returns true for the keys that are removed otherwise false is returned.
The update method updates the given key with given value. Returns true when key otherwise false will be returned.
The updateMany method updates the given keys. Returns true for the keys that where updated otherwise false will be returned.
The ICache contract defines a way for storing data as key-value pairs independent of data storage. It commes with more convient methods compared to ICacheAdapter.