partial.js logo
Latest version
v1.3.1 (RC2)

FrameworkCache


The framework is using this class for storing views, templates, resources, etc..


framework.cache.add('key', 'value', new Date().add('day', 1));
console.log(framework.read('key'));

// OR (is the same as)

controller.cache.add('key', { name: 'Peter Širka' }, new Date().add('minute', 10));
console.log(controller.read('key'));

Properties


framework.cache.count {Number}framework.cache.repository {Object}
framework.cache.count;
readonly
return Number;

Count of cache recycle.

framework.cache.repository;
readonly
return Object;

All cache items collection.

Methods


framework.cache.add(name, value, expire)framework.cache.clear {FrameworkCache}framework.cache.fn(name, fnCache, [fnCallback])framework.cache.read(name)framework.cache.remove(name)framework.cache.removeAll(search)framework.cache.setExpire(name, expire)
framework.cache.add(name, value, expire);
return Object;

Add a item into the cache and return a value.

framework.cache.clear;
return FrameworkCache;

Clear cache items.

framework.cache.fn(name, fnCache, [fnCallback]);
return FrameworkCache;

Simply cache for storing a function.

framework.cache.read(name);Default: null
return Object;

Read value from the cache.

framework.cache.remove(name);Default: null
return Object;

Remove item from the cache.

framework.cache.removeAll(search);
return Number;

Remove items from the cache.

framework.cache.setExpire(name, expire);
return FrameworkCache;

Set item expiration.