en | fr

The Cache class


This 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.


initialize

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


add

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

Returns Object


fetch

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