MServiceCache

MServiceCache ⇐ Trait

A mixin that offers helpers to handle errors on services.

Kind: global mixin
Extends: Trait
Properties

NameTypeDescription
_cacheObject

The cache

_cacheToRefreshboolean

True if the cache is obsolete

_timestampObject

key cache duration before invalidation

_addToCacheSync(key, value, [options]) ⇒ *

Add an object to the cache

Kind: static method of MServiceCache
Access: protected

ParamTypeDefaultDescription
keyString

The object identifier

valueObject

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

ParamTypeDescription
keyString

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

ParamTypeDescription
keyString

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

ParamTypeDescription
keyString

The object identifier

_deleteFromCacheSync(key)

Delete the object referenced by it’s id from the cache

Kind: static method of MServiceCache
Access: protected

ParamTypeDescription
keyString

The object identifier

_resetCacheSync()

Reset the cache, ie delete all object from it.

Kind: static method of MServiceCache
Access: protected