-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
Description
Line 1584 in 2a789c6
| // @TODO: Use cache.prune() instead, which will be fixed in next Protoblast version |
return instance;
});
/**
* Prune all the caches
*
* @author Jelle De Loecker <jelle@elevenways.be>
* @since 1.4.0
* @version 1.4.0
*/
Alchemy.setMethod(function pruneCaches(force_log = true) {
let checked = 0,
pruned = 0;
let do_log;
if (force_log === 'auto') {
do_log = alchemy.settings.debugging.debug;
} else {
do_log = force_log;
}
for (let key in this.caches) {
let cache = this.caches[key];
if (!cache) {
continue;
}
checked++;
let old_length = cache.length;
for (let entry of cache) {
// This triggers a check of all the entries
// @TODO: Use cache.prune() instead, which will be fixed in next Protoblast version
}
let new_length = cache.length;
if (new_length != old_length) {
pruned++;
if (do_log) {
console.log('Pruned cache', cache, 'from', old_length, 'to', new_length);
}
}
}
if (do_log) {
console.log('Checked', checked, 'caches and pruned', pruned, 'of them');
}
});
/**
* Get a route
*