Socket
Socket
Sign inDemoInstall

catbox

Package Overview
Dependencies
Maintainers
5
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

catbox - npm Package Compare versions

Comparing version 9.0.0 to 10.0.0

33

lib/client.js

@@ -33,11 +33,11 @@ 'use strict';

internals.Client.prototype.start = function () {
internals.Client.prototype.start = async function () {
return internals.promised(this.connection, 'start');
await this.connection.start();
};
internals.Client.prototype.stop = function () {
internals.Client.prototype.stop = async function () {
return this.connection.stop();
await this.connection.stop();
};

@@ -72,3 +72,3 @@

const result = await internals.promised(this.connection, 'get', key);
const result = await this.connection.get(key);
if (!result ||

@@ -112,3 +112,3 @@ result.item === undefined ||

return await internals.promised(this.connection, 'set', key, value, ttl);
await this.connection.set(key, value, ttl);
};

@@ -127,3 +127,3 @@

return await internals.promised(this.connection, 'drop', key); // Always drop, regardless of caching rules
await this.connection.drop(key); // Always drop, regardless of caching rules
};

@@ -136,20 +136,1 @@

};
internals.promised = function (obj, method, ...args) {
const deferred = {};
const callbackPromise = new Promise((resolve, reject) => {
deferred.resolve = resolve;
deferred.reject = reject;
});
const result = obj[method](...args, (err, value) => {
return err ? deferred.reject(err) : deferred.resolve(value);
});
const isPromiseResult = !!(result && result.then);
return isPromiseResult ? result : callbackPromise;
};
{
"name": "catbox",
"description": "Multi-strategy object caching service",
"version": "9.0.0",
"version": "10.0.0",
"repository": "git://github.com/hapijs/catbox",

@@ -13,3 +13,3 @@ "main": "lib/index.js",

"engines": {
"node": ">=8.0.0"
"node": ">=8.9.0"
},

@@ -23,3 +23,3 @@ "dependencies": {

"code": "5.x.x",
"lab": "14.x.x"
"lab": "15.x.x"
},

@@ -26,0 +26,0 @@ "scripts": {

![catbox Logo](https://raw.github.com/hapijs/catbox/master/images/catbox.png)
Multi-strategy object caching service
Version: **8.x**
Version: **9.x**

@@ -115,8 +115,5 @@ [![Build Status](https://secure.travis-ci.org/hapijs/catbox.svg)](http://travis-ci.org/hapijs/catbox)

- `generateFunc` - a function used to generate a new cache item if one is not found in the
cache when calling `get()`. The method's signature is `function(id, next)` where:
cache when calling `get()`. The method's signature is `async function(id, flags)` where:
- `id` - the `id` string or object provided to the `get()` method.
- `next` - the method called when the new item is returned with the signature
`function(err, value, ttl)` where:
- `err` - an error condition.
- `value` - the new value generated.
- `flags` - an object used to pass back additional flags:
- `ttl` - the cache ttl value in milliseconds. Set to `0` to skip storing in the cache.

@@ -123,0 +120,0 @@ Defaults to the cache global policy.

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