lrucache

WebJar for lrucache

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

lrucache
Последняя версия

Последняя версия

1.0.3
Дата

Дата

Тип

Тип

jar
Описание

Описание

lrucache
WebJar for lrucache
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/zensh/lrucache

Скачать lrucache

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/lrucache/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>lrucache</artifactId>
    <version>1.0.3</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/lrucache/
implementation 'org.webjars.npm:lrucache:1.0.3'
// https://jarcasting.com/artifacts/org.webjars.npm/lrucache/
implementation ("org.webjars.npm:lrucache:1.0.3")
'org.webjars.npm:lrucache:jar:1.0.3'
<dependency org="org.webjars.npm" name="lrucache" rev="1.0.3">
  <artifact name="lrucache" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='lrucache', version='1.0.3')
)
libraryDependencies += "org.webjars.npm" % "lrucache" % "1.0.3"
[org.webjars.npm/lrucache "1.0.3"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

LRUCache

LRU Cache for node.js/browser.

NPM version Build Status Downloads

使用链表实现的 LRU 缓存。getsetupdate 方法会更新 LRU 优先级。

Install

Node.js:

npm install lrucache

bower:

bower install lrucache

Browser:

<script src="/pathTo/lrucache.js"></script>

API

const LRUCache = require('lrucache')

Class LRUCache([capacity])

  • capacity: : Optional, Type: Number, Default: Number.MAX_SAFE_INTEGER.
const cache = LRUCache(100)

LRUCache.prototype.get(key)

Return value.

let a = cache.get('a')

LRUCache.prototype.set(key, value)

Return this.

cache.set('a', [1, 2, 3])

LRUCache.prototype.update(key, fn)

Return this, It only run when key exists.

cache.update('a', function (a) {
  a.push(4)
  return a
})

LRUCache.prototype.remove(key)

Return this.

cache.remove('a')

LRUCache.prototype.removeAll(key)

Return this.

cache.removeAll()

LRUCache.prototype.keys()

Return a array of keys.

cache.keys()

LRUCache.prototype.has(key)

Return true or false.

cache.has('a')

LRUCache.prototype.staleKey()

Return the stalest key or null.

let staleKey = cache.staleKey()

LRUCache.prototype.popStale()

Return the stalest data or null.

let staleDate = cache.popStale()

LRUCache.prototype.info()

Return info.

cache.info()

Версии библиотеки

Версия
1.0.3