Skip to content
Jesper Lindström edited this page Jun 8, 2014 · 2 revisions

To make sure your single page application is fast and responsive to the user, it's a good idea to cache data, especially if it's retrieved from a slow API server. Zeus provide basic caching through in-memory storage for visit-long storage capabilities.

app.core.cache.add(key, value, expiration)

Store data in the cache.

  • key (String): identifier for the cache object (preferably in serviceName.dataName format)
  • value (Anything): the data to store
  • expiration (Optional, integer): number of seconds to keep the data in cache. Defaults to forever.

app.core.cache.get(key)

Get data from the cache by identifier key.

  • key (String): identifier for the cache object
  • Return: Mixed

app.core.cache.has(key)

Check if a certain identifier key is in the cache. Expired objects are treated as nonexistent.

  • key (String): identifier for the cache object
  • Return: Boolean

app.core.cache.remove(key)

Remove a certain cache object by identifier key.

  • key (String): identifier for the cache object

Clone this wiki locally