Socket
Socket
Sign inDemoInstall

record-cache

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

record-cache - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

2

index.js

@@ -78,2 +78,3 @@ var EMPTY = []

this._onstale = opts.onStale || opts.onstale || null
this._fresh = new RecordStore()

@@ -135,2 +136,3 @@ this._stale = new RecordStore()

RecordCache.prototype._gc = function () {
if (this._onstale && this._stale.size > 0) this._onstale(this._stale)
this._stale = this._fresh

@@ -137,0 +139,0 @@ this._fresh = new RecordStore()

2

package.json
{
"name": "record-cache",
"version": "1.0.2",
"version": "1.1.0",
"description": "Cache optimised for record like things",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -44,3 +44,4 @@ # record-cache

maxSize: 1000, // approximate max size
maxAge: 1000 // approximate max age in ms
maxAge: 1000, // approximate max age in ms
onStale: false // function called when evicting stale records
}

@@ -50,3 +51,3 @@ ```

In the worst case the cache will be `2 * maxSize` large, and
if maxAge is used old values are gc'ed every `0.66 * maxAge - 1.33 * maxAge`.
if `maxAge` is used old values are gc'ed every `0.66 * maxAge - 1.33 * maxAge` with an optional callback to the `onStale` function upon record eviction.

@@ -53,0 +54,0 @@ This is to greatly simplify the data structures and also gives us a pretty decent

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc