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

(开头部分) 3KB

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

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

Basic cache object for storing key-value pairs.

## Install

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

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

Based on MapCache in Lo-dash v3.0. [MIT License](https://github.com/lodash/lodash/blob/master/LICENSE.txt)

## Usage

```js
var MapCache = require('map-cache');
var mapCache = new MapCache();
```

## API

### [MapCache](index.js#L28)

Creates a cache object to store key/value pairs.

**Example**

```js
var cache = new MapCache();
```

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

Adds `value` to `key` on the cache.

**Params**

* `key` **{String}**: The key of the value to cache.
* `value` **{any}**: The value to cache.
* `returns` **{Object}**: Returns the `Cache` object for chaining.

**Example**

```js
cache.set('foo', 'bar');
```

### [.get](index.js#L65)

Gets the cached value for `key`.

**Params**

* `key` **{String}**: The key of the value to get.
* `returns` **{any}**: Returns the cached value.

**Example**

后面还有 85 行代码,解锁后查看完整代码

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

AI 解读

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

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