Code coverage report for dist\lib\ModelCache.js

Statements: 100% (18 / 18)      Branches: 100% (12 / 12)      Functions: 100% (5 / 5)      Lines: 100% (18 / 18)      Ignored: none     

All files » dist/lib/ » ModelCache.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 251 1 1 31   1 412 394 18   1 97 95 2   1 76 72 4   1   1    
var Bluebird = require('bluebird');
var ModelCache = (function () {
    function ModelCache(model) {
        this.model = model;
    }
    ModelCache.prototype.set = function (value) {
        if (!this.model.cacheDirector || !this.model.cacheDirector.valid(value))
            return;
        this.model.core.cache.set(this.model.cacheDirector.buildKey(value), value);
    };
    ModelCache.prototype.get = function (conditions) {
        if (!this.model.cacheDirector || !this.model.cacheDirector.validQuery(conditions))
            return Bluebird.resolve(null);
        return this.model.core.cache.get(this.model.cacheDirector.buildQueryKey(conditions));
    };
    ModelCache.prototype.clear = function (conditions) {
        if (!this.model.cacheDirector || !this.model.cacheDirector.validQuery(conditions))
            return;
        this.model.core.cache.clear(this.model.cacheDirector.buildQueryKey(conditions));
    };
    return ModelCache;
})();
exports.default = ModelCache;
 
//# sourceMappingURL=../lib/ModelCache.js.map