import CacheAdapterNodecache from 'devapt-core-common/js/cache/cache_adapter_node_cache.js'
CacheAdapterNodecache
Extends:
Cache adapter for node-cache.
Example:
API:
->constructor(arg_settings={ttl:5000, check_period:1000}) - time unit is milliseconds
->get(arg_key:string, arg_default):Promise
->mget(arg_keys:array, arg_default:any|array):Promise
->has(arg_key:string):Promise
->set(arg_key:string, arg_value, arg_ttl=undefined):Promise
->set_ttl(arg_key:string, arg_ttl):Promise
->get_ttl(arg_key:string):Promise
->get_keys():Promise
->remove(arg_keys:string|array):Promise
->flush():nothing - delete all entries.
->close():nothing - clear interval timeout for checks.
Constructor Summary
Public Constructor | ||
public |
constructor(arg_settings: object): nothing Create Cache instance to manage cached datas. |
Member Summary
Public Members | ||
public |
Class type flag. |
Private Members | ||
private |
_engine: NodeCache Cache storage engine. |
Method Summary
Public Methods | ||
public |
Close cache engine. |
|
public |
Flush all cached values (clear interval timeout for checks). |
|
public |
Get a cached value. |
|
public |
Get cached keys. |
|
public |
Get cached value ttl. |
|
public |
Test if given key has a cached value. |
|
public |
Get a cached value. |
|
public |
Remove a cached value. |
|
public |
Set a cached value with given key. |
|
public |
Set cached value ttl. |
Inherited Summary
From class CacheAdapter | ||
public |
Class type flag. |
|
public |
Close cache engine. |
|
public |
Flush all cached values (clear interval timeout for checks). |
|
public |
Get a cached value. |
|
public |
Get cached keys. |
|
public |
Get cached value ttl. |
|
public |
Test if given key has a cached value. |
|
public |
Get a cached value. |
|
public |
Remove a cached value. |
|
public |
Set a cached value with given key. |
|
public |
Set cached value ttl. |
Public Constructors
public constructor(arg_settings: object): nothing source
Create Cache instance to manage cached datas.
Override:
CacheAdapter#constructorParams:
Name | Type | Attribute | Description |
arg_settings | object | cache engine settings. |
Return:
nothing |
Public Members
Private Members
Public Methods
public flush(): Promise source
Flush all cached values (clear interval timeout for checks).
Override:
CacheAdapter#flushpublic get(arg_key: string, arg_default: any): Promise source
Get a cached value.
Override:
CacheAdapter#getParams:
Name | Type | Attribute | Description |
arg_key | string | key string to retrieve the value. |
|
arg_default | any | returned default value if the key is not found (optional) (default:undefined). |
public get_ttl(arg_key: string): Promise source
Get cached value ttl.
Override:
CacheAdapter#get_ttlParams:
Name | Type | Attribute | Description |
arg_key | string | key string to retrieve the value. |
public has(arg_key: string): Promise source
Test if given key has a cached value.
Override:
CacheAdapter#hasParams:
Name | Type | Attribute | Description |
arg_key | string | key string to retrieve the value. |
public mget(arg_keys: array, arg_default: any): Promise source
Get a cached value.
Override:
CacheAdapter#mgetParams:
Name | Type | Attribute | Description |
arg_keys | array | key strings to retrieve the values. |
|
arg_default | any | returned default value if the key is not found (optional) (default:undefined). |
public remove(arg_keys: string | array): Promise source
Remove a cached value.
Override:
CacheAdapter#removeParams:
Name | Type | Attribute | Description |
arg_keys | string | array | value key string or array. |
public set(arg_key: string, arg_value: any, arg_ttl: integer): Promise source
Set a cached value with given key.
Override:
CacheAdapter#setParams:
Name | Type | Attribute | Description |
arg_key | string | key string to retrieve the value. |
|
arg_value | any | value to cache. |
|
arg_ttl | integer | time to leave for cached value. |
public set_ttl(arg_key: string, arg_ttl: integer): Promise source
Set cached value ttl.
Override:
CacheAdapter#set_ttlParams:
Name | Type | Attribute | Description |
arg_key | string | key string to retrieve the value. |
|
arg_ttl | integer | time to leave for cached value in milliseconds. |