Cache
Cache
classThis class is responsible for all the caching inside the application.
This is mostly just a big hash which is clever enough to set some default values and deal with paginated contents.
Initializes the different pieces of the cache to make
sure that we are dealing with empty objects and not
undefined
for the first checks.
Returns null
Facility to add elements to a specific cache section.
When the section is empty, the given data is roughly stored.
When the section is already filled, the existing collection will be concatenated with the given one and the cursor to the next data page will be updated as well.
Parameters
module
String The module identifier; i.e.
the root section.section
String The section to fill.data
Object The data to store.Returns Object
Wraps cache sections within a Promise object. This is a facility to return data inside a Promise since model methods return such kind of objects.
Parameters
Returns Promise