raptor
Version:
RaptorJS provides an AMD module loader that works in Node, Rhino and the web browser. It also includes various sub-modules to support building optimized web applications.
33 lines (25 loc) • 884 B
JavaScript
define(
'raptor/caching/SimpleCacheProvider',
function(require) {
"use strict";
var SimpleCache = require('raptor/caching/SimpleCache');
var SimpleCacheProvider = function() {
this.cachesByName = {};
};
SimpleCacheProvider.prototype = {
getCache: function(name) {
if (name == null) {
name = "DEFAULT";
}
var cache = this.cachesByName[name];
if (!cache) {
this.cachesByName[name] = cache = new SimpleCache();
}
return cache;
},
clearAllCaches: function() {
this.cachesByName = {};
}
};
return SimpleCacheProvider;
});