mirror of
https://github.com/wassname/HackFlowy.git
synced 2026-06-27 16:00:04 +08:00
69 lines
3.3 KiB
JavaScript
69 lines
3.3 KiB
JavaScript
/* automatically generated by JSCoverage - do not edit */
|
|
if (typeof _$jscoverage === 'undefined') _$jscoverage = {};
|
|
if (! _$jscoverage['cache.js']) {
|
|
_$jscoverage['cache.js'] = [];
|
|
_$jscoverage['cache.js'][12] = 0;
|
|
_$jscoverage['cache.js'][21] = 0;
|
|
_$jscoverage['cache.js'][22] = 0;
|
|
_$jscoverage['cache.js'][23] = 0;
|
|
_$jscoverage['cache.js'][24] = 0;
|
|
_$jscoverage['cache.js'][35] = 0;
|
|
_$jscoverage['cache.js'][36] = 0;
|
|
_$jscoverage['cache.js'][37] = 0;
|
|
_$jscoverage['cache.js'][47] = 0;
|
|
_$jscoverage['cache.js'][48] = 0;
|
|
_$jscoverage['cache.js'][59] = 0;
|
|
_$jscoverage['cache.js'][60] = 0;
|
|
_$jscoverage['cache.js'][71] = 0;
|
|
_$jscoverage['cache.js'][73] = 0;
|
|
_$jscoverage['cache.js'][76] = 0;
|
|
_$jscoverage['cache.js'][78] = 0;
|
|
_$jscoverage['cache.js'][79] = 0;
|
|
_$jscoverage['cache.js'][80] = 0;
|
|
}
|
|
_$jscoverage['cache.js'][12]++;
|
|
module.exports = Cache;
|
|
_$jscoverage['cache.js'][21]++;
|
|
function Cache(limit) {
|
|
_$jscoverage['cache.js'][22]++;
|
|
this.store = {};
|
|
_$jscoverage['cache.js'][23]++;
|
|
this.keys = [];
|
|
_$jscoverage['cache.js'][24]++;
|
|
this.limit = limit;
|
|
}
|
|
_$jscoverage['cache.js'][35]++;
|
|
Cache.prototype.touch = (function (key, i) {
|
|
_$jscoverage['cache.js'][36]++;
|
|
this.keys.splice(i, 1);
|
|
_$jscoverage['cache.js'][37]++;
|
|
this.keys.push(key);
|
|
});
|
|
_$jscoverage['cache.js'][47]++;
|
|
Cache.prototype.remove = (function (key) {
|
|
_$jscoverage['cache.js'][48]++;
|
|
delete this.store[key];
|
|
});
|
|
_$jscoverage['cache.js'][59]++;
|
|
Cache.prototype.get = (function (key) {
|
|
_$jscoverage['cache.js'][60]++;
|
|
return this.store[key];
|
|
});
|
|
_$jscoverage['cache.js'][71]++;
|
|
Cache.prototype.add = (function (key) {
|
|
_$jscoverage['cache.js'][73]++;
|
|
var len = this.keys.push(key);
|
|
_$jscoverage['cache.js'][76]++;
|
|
if (len > this.limit) {
|
|
_$jscoverage['cache.js'][76]++;
|
|
this.remove(this.keys.shift());
|
|
}
|
|
_$jscoverage['cache.js'][78]++;
|
|
var arr = this.store[key] = [];
|
|
_$jscoverage['cache.js'][79]++;
|
|
arr.createdAt = new Date();
|
|
_$jscoverage['cache.js'][80]++;
|
|
return arr;
|
|
});
|
|
_$jscoverage['cache.js'].source = ["","/*!"," * Connect - Cache"," * Copyright(c) 2011 Sencha Inc."," * MIT Licensed"," */","","/**"," * Expose `Cache`."," */","","module.exports = Cache;","","/**"," * LRU cache store."," *"," * @param {Number} limit"," * @api private"," */","","function Cache(limit) {"," this.store = {};"," this.keys = [];"," this.limit = limit;","}","","/**"," * Touch `key`, promoting the object."," *"," * @param {String} key"," * @param {Number} i"," * @api private"," */","","Cache.prototype.touch = function(key, i){"," this.keys.splice(i,1);"," this.keys.push(key);","};","","/**"," * Remove `key`."," *"," * @param {String} key"," * @api private"," */","","Cache.prototype.remove = function(key){"," delete this.store[key];","};","","/**"," * Get the object stored for `key`."," *"," * @param {String} key"," * @return {Array}"," * @api private"," */","","Cache.prototype.get = function(key){"," return this.store[key];","};","","/**"," * Add a cache `key`."," *"," * @param {String} key"," * @return {Array}"," * @api private"," */","","Cache.prototype.add = function(key){"," // initialize store"," var len = this.keys.push(key);",""," // limit reached, invalidate LRU"," if (len > this.limit) this.remove(this.keys.shift());",""," var arr = this.store[key] = [];"," arr.createdAt = new Date;"," return arr;","};"];
|