mirror of
https://github.com/beestat/app.git
synced 2025-05-24 02:14:03 -04:00
Added documentation to cache
This commit is contained in:
parent
206af04d46
commit
d9fd07618a
@ -2,6 +2,12 @@ beestat.cache = {
|
||||
'data': {}
|
||||
};
|
||||
|
||||
/**
|
||||
* Overwrite a cache key with new data. Dispatches an event when done.
|
||||
*
|
||||
* @param {string} key The cache key to update.
|
||||
* @param {object} value The data to be placed in that key.
|
||||
*/
|
||||
beestat.cache.set = function(key, value) {
|
||||
if (key.substring(0, 5) === 'data.') {
|
||||
beestat.cache.data[key.substring(5)] = value;
|
||||
@ -11,6 +17,11 @@ beestat.cache.set = function(key, value) {
|
||||
beestat.dispatcher.dispatchEvent('cache.' + key);
|
||||
};
|
||||
|
||||
/**
|
||||
* Delete data from the cache. Dispatches an event when done.
|
||||
*
|
||||
* @param {string} key The cache key to delete.
|
||||
*/
|
||||
beestat.cache.delete = function(key) {
|
||||
if (key.substring(0, 5) === 'data.') {
|
||||
delete beestat.cache.data[key.substring(5)];
|
||||
|
Loading…
x
Reference in New Issue
Block a user