New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bluecache

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bluecache - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

2

package.json
{
"name": "bluecache",
"description": "In-memory, read-through, Promises/A+, lru-cache",
"version": "0.2.0",
"version": "0.2.1",
"author": "kurttheviking <kurttheviking@outlook.com>",

@@ -6,0 +6,0 @@ "contributors": [

@@ -11,5 +11,5 @@ <a href="http://promisesaplus.com/">

### Usage
## Usage
First, instantiate the cache, passing [options](https://github.com/kurttheviking/bluecache#options) if necessary.
First, instantiate the cache &ndash; passing [options](https://github.com/kurttheviking/bluecache#options) if necessary.

@@ -26,3 +26,3 @@ ```

Traditional LRU cache "getting" and "setting" takes place within a single call, promoting functional use. The `cache` instance is a Promise-returning function which takes two parameters: a String for the cache key and a Promise-returning function which resolves to the value to store in the cache. The cached value can be of any type.
Traditional cache "getting" and "setting" takes place within a single call, promoting functional use. The `cache` instance is a Promise-returning function which takes two parameters: a String for the cache key and a Promise-returning function which resolves to the value to store in the cache. The cached value can be of any type.

@@ -39,3 +39,3 @@ ```

### Options
## Options

@@ -51,8 +51,8 @@ Options are passed directly to [lru-cache](https://github.com/isaacs/node-lru-cache#options) at instantiation

### Emitted events
## Emitted events
The cache instance is also an [event emitter](http://nodejs.org/api/events.html#events_class_events_eventemitter) which provides an `on` method against which the implementing application can listen for certain events.
The cache instance is also an [event emitter](http://nodejs.org/api/events.html#events_class_events_eventemitter) which provides an `on` method against which the implementing application can listen for the below events.
**cache:hit**
#### cache:hit

@@ -68,3 +68,3 @@ ```

**cache:miss**
#### cache:miss

@@ -80,12 +80,12 @@ ```

### API
## API
**cache(key, dataFunction)**
#### cache(key, dataFunction)
Attempts to get the current value of `key` from the cache. If the key exists, the "recently-used"-ness of the key is updated and the cached value is returned. If the key does not exist, the `dataFunction` is executed and the returned Promise resolved to its underlying value before being set in the cache and returned. (To support advanced cases, the key can also be a Promise for a String.)
A rejected promise is returned if either `key` or `dataFunction` are missing.
A rejected promise is returned if either `key` or `dataFunction` is missing.
**cache.del(key)**
#### cache.del(key)

@@ -95,3 +95,3 @@ Returns a promise that resolves to `undefined` after deleting `key` from the cache.

**cache.on(eventName, eventHandler)**
#### cache.on(eventName, eventHandler)

@@ -107,3 +107,3 @@ `eventName` is a string, corresponding to a [supported event](https://github.com/kurttheviking/bluecache#emitted-events). `eventHandler` is a function which responds to the data provided by the target event.

**cache.reset()**
#### cache.reset()

@@ -113,3 +113,3 @@ Returns a promise that resolves to `undefined` after removing all data from the cache.

### Contribute
## Contribute

@@ -119,3 +119,3 @@ PRs are welcome! For bugs, please include a failing test which passes when your PR is applied.

### Release history
## Release history

@@ -122,0 +122,0 @@ The `0.1.x` versions focused on API parity with the underlying lru-cache. However, [Bluebird promisification](https://github.com/petkaantonov/bluebird/blob/master/API.md#promisification) makes that use case unnecessary (though perhaps a bit more complicated). The `0.2.x`+ versions refocus bluecache on implementing lru-cache as a more functionally-oriented, read-through, Promises/A+ module.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc