appolo-cache
Advanced tools
Comparing version 6.0.1 to 6.0.2
@@ -21,3 +21,3 @@ { | ||
"main": "./index.js", | ||
"version": "6.0.1", | ||
"version": "6.0.2", | ||
"license": "MIT", | ||
@@ -24,0 +24,0 @@ "repository": { |
@@ -8,3 +8,3 @@ # Appolo lru cache | ||
```javascript | ||
npm install rocket-lru --save | ||
npm install appolo-cache --save | ||
``` | ||
@@ -15,3 +15,3 @@ | ||
```javascript | ||
import {Cache} from "rocket-lru"; | ||
import {Cache} from "appolo-cache"; | ||
@@ -38,42 +38,42 @@ //max items in cache is 5 and all the items will expire after 1 second | ||
### `set(key, value, [maxAge])` | ||
#### `set(key, value, [maxAge])` | ||
Set the value of the key and mark the key as most recently used. | ||
if maxAge is passed the item will expire after maxAge ms. | ||
### `get(key)` | ||
#### `get(key)` | ||
Return the value of the key. | ||
If the key is not found or expired return `null`. | ||
mark the key as most recently used. | ||
### `peek(key)` | ||
#### `peek(key)` | ||
return the value of the key | ||
If the key is not found or expired return `null`. | ||
will not update recently used. | ||
### `del(key)` | ||
#### `del(key)` | ||
Deletes a key out of the cache. | ||
### `reset()` | ||
#### `reset()` | ||
Reset the cache and delete all items. | ||
### `has(key)` | ||
#### `has(key)` | ||
Return true if a key is in the cache, will not update recently used | ||
### `forEach(function(value,key,cache), [this])` | ||
#### `forEach(function(value,key,cache), [this])` | ||
Loop over the cache items | ||
### `keys()` | ||
#### `keys()` | ||
Return an array of the keys in the cache. | ||
### `values()` | ||
#### `values()` | ||
Return an array of the values in the cache. | ||
### `size` | ||
#### `size` | ||
Return the size of the cache. | ||
### `prune()` | ||
#### `prune()` | ||
Delete all expired items. | ||
### `pop()` | ||
#### `pop()` | ||
Remove and return the least recently used | ||
### `maxAge` | ||
#### `maxAge` | ||
getter setter cache max age. | ||
### `maxSize` | ||
#### `maxSize` | ||
getter setter cache max size. | ||
### `maxSize` | ||
#### `maxSize` | ||
getter setter cache max size. | ||
### `hit(key)` | ||
#### `hit(key)` | ||
Mark the key as most recently used. | ||
### `ttl(key)` | ||
#### `ttl(key)` | ||
Get the ttl time left of the key item. | ||
### `expire(key,maxAge)` | ||
#### `expire(key,maxAge)` | ||
Update the expire time of the key item. | ||
@@ -80,0 +80,0 @@ |
27933