Acme.BookStore.HttpApi.Host/node_modules/fragment-cache/index.js
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
/*!
* fragment-cache <https://github.com/jonschlinkert/fragment-cache>
*
* Copyright (c) 2016-2017, Jon Schlinkert.
* Released under the MIT License.
*/
'use strict';
var MapCache = require('map-cache');
/**
* Create a new `FragmentCache` with an optional object to use for `caches`.
*
* ```js
* var fragment = new FragmentCache();
* ```
* @name FragmentCache
* @param {String} `cacheName`
* @return {Object} Returns the [map-cache][] instance.
* @api public
*/
function FragmentCache(caches) {
this.caches = caches || {};
}
/**
* Prototype
*/
FragmentCache.prototype = {
/**
* Get cache `name` from the `fragment.caches` object. Creates a new
* `MapCache` if it doesn't already exist.
*
* ```js
* var cache = fragment.cache('files');
* console.log(fragment.caches.hasOwnProperty('files'));
* //=> true
* ```
* @name .cache
* @param {String} `cacheName`
* @return {Object} Returns the [map-cache][] instance.
* @api public
*/
cache: function(cacheName) {
return this.caches[cacheName] || (this.caches[cacheName] = new MapCache());
},
/**
* Set a value for property `key` on cache `name`
*
* ```js
* fragment.set('files', 'somefile.js', new File({path: 'somefile.js'}));
* ```
* @name .set
* @param {String} `name`
后面还有 68 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
