MServiceCache
MServiceCache ⇐ Trait
A mixin that offers helpers to handle errors on services.
Kind: global mixin
Extends: Trait
Properties
Name | Type | Description |
---|---|---|
_cache | Object | The cache |
_cacheToRefresh | boolean | True if the cache is obsolete |
_timestamp | Object | key cache duration before invalidation |
- MServiceCache ⇐
Trait
_addToCacheSync(key, value, [options]) ⇒ *
Add an object to the cache
Kind: static method of MServiceCache
Access: protected
Param | Type | Default | Description |
---|---|---|---|
key | String | The object identifier | |
value | Object | The object to store | |
[options] | Object | Additional options | |
[options.duration] | Number |
| Duration in milliseconds before invalidation of cache (if null, $$maxAge value is used by default) |
_getFromCache(key) ⇒ Promise
Get an object from the cache Warning: asynchronous method that returns a Promise
Kind: static method of MServiceCache
Returns: Promise
- A promise (object,error)
Access: protected
Param | Type | Description |
---|---|---|
key | String | The object identifier |
_getFromCacheSync(key) ⇒ Object
Get an object from the cache
Kind: static method of MServiceCache
Returns: Object
- The object or null
Access: protected
Param | Type | Description |
---|---|---|
key | String | The object identifier |
_hasFromCacheSync(key) ⇒ boolean
Return true if object referenced by the key is in the cache
Kind: static method of MServiceCache
Returns: boolean
- True if object is in the cache
Access: protected
Param | Type | Description |
---|---|---|
key | String | The object identifier |
_deleteFromCacheSync(key)
Delete the object referenced by it’s id from the cache
Kind: static method of MServiceCache
Access: protected
Param | Type | Description |
---|---|---|
key | String | The object identifier |
_resetCacheSync()
Reset the cache, ie delete all object from it.
Kind: static method of MServiceCache
Access: protected