Acme.BookStore.HttpApi.Host/node_modules/fragment-cache/README.md

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

# fragment-cache [![NPM version](https://img.shields.io/npm/v/fragment-cache.svg?style=flat)](https://www.npmjs.com/package/fragment-cache) [![NPM downloads](https://img.shields.io/npm/dm/fragment-cache.svg?style=flat)](https://npmjs.org/package/fragment-cache) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/fragment-cache.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/fragment-cache)

> A cache for managing namespaced sub-caches

## Install

Install with [npm](https://www.npmjs.com/):

```sh
$ npm install --save fragment-cache
```

## Usage

```js
var Fragment = require('fragment-cache');
var fragment = new Fragment();
```

## API

### [FragmentCache](index.js#L24)

Create a new `FragmentCache` with an optional object to use for `caches`.

**Example**

```js
var fragment = new FragmentCache();
```

**Params**

* `cacheName` **{String}**
* `returns` **{Object}**: Returns the [map-cache](https://github.com/jonschlinkert/map-cache) instance.

### [.cache](index.js#L49)

Get cache `name` from the `fragment.caches` object. Creates a new `MapCache` if it doesn't already exist.

**Example**

```js
var cache = fragment.cache('files');
console.log(fragment.caches.hasOwnProperty('files'));
//=> true
```

**Params**

* `cacheName` **{String}**
* `returns` **{Object}**: Returns the [map-cache](https://github.com/jonschlinkert/map-cache) instance.

### [.set](index.js#L67)

Set a value for property `key` on cache `name`

**Example**

```js
后面还有 96 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。