new baseCacheManagementKlass(params)
constructor
Parameters:
Name | Type | Description |
---|---|---|
params |
Object | cache key generation & expiry related params |
Methods
-
_cacheKeyPrefix()
-
cache key prefix
Returns:
- Type
- String
-
_fetchFromCache()
-
fetch from cache
Returns:
- Type
- Object
-
_setCache(dataToSet)
-
set data in cache.
Parameters:
Name Type Description dataToSet
Object data to se tin cache Returns:
- Type
- Result
-
_sharedCacheKeyPrefix()
-
Shared cache key prefix This cache is shared between company api and saas Cache keys with these prefixes can be flushed via company api or saas.
Returns:
- Type
- String
-
clear()
-
clear cache
Returns:
- Type
- Promise.<Result>
-
fetch()
-
Fetch data from cache, in case of cache miss calls sub class method to fetch data from source
Returns:
- On success, data.value has value. On failure, error details returned.- Type
- Promise.<Result>
-
fetchDataFromSource()
-
fetch data from source return should be of klass Result data attr of return is returned and set in cache
Returns:
- Type
- Result
-
setCacheExpiry()
-
set cache expiry in oThis.cacheExpiry and return it
Returns:
- Type
- Number
-
setCacheKey()
-
set cache key in oThis.cacheKey and return it
Returns:
- Type
- String