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

cacheman-memory

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

cacheman-memory - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

23

index.js

@@ -40,3 +40,3 @@ 'use strict';

fn = fn || noop;
var data = this.client.get(key);
var val, data = this.client.get(key);
if (!data) return fn(null, data);

@@ -48,6 +48,10 @@ if (data.expire < Date.now()) {

try {
fn(null, JSON.parse(data.value));
val = JSON.parse(data.value);
} catch (e) {
fn(e);
return fn(e);
}
process.nextTick(function tick() {
fn(null, val);
});
};

@@ -67,2 +71,3 @@

var data;
if ('function' === typeof ttl) {

@@ -75,6 +80,6 @@ fn = ttl;

if ('undefined' === typeof val) return fn(null, null);
if ('undefined' === typeof val) return fn();
try {
var data = {
data = {
value: JSON.stringify(val),

@@ -84,7 +89,11 @@ expire: Date.now() + ((ttl || 60) * 1000)

} catch (e) {
fn(e);
return fn(e);
}
this.client.set(key, data);
fn(null, val);
process.nextTick(function tick() {
fn(null, val);
});
};

@@ -91,0 +100,0 @@

{
"name": "cacheman-memory",
"version": "0.1.0",
"version": "0.1.1",
"description": "In-memory caching library for Node.JS and also cache engine for cacheman",

@@ -5,0 +5,0 @@ "author": "Jonathan Brumley <cayasso@gmail.com>",

@@ -77,3 +77,3 @@ # cacheman-memory

Retreives a value for a given key, if there is no value for the given key a null value will be returned.
Retrieves a value for a given key, if there is no value for the given key a null value will be returned.

@@ -80,0 +80,0 @@ ```javascript

@@ -16,2 +16,9 @@ var assert = require('assert')

});
it('should have main methods', function () {
assert.ok(cache.set);
assert.ok(cache.get);
assert.ok(cache.del);
assert.ok(cache.clear);
});

@@ -18,0 +25,0 @@ it('should store items', function (done) {

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