Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@koopjs/cache-redis

Package Overview
Dependencies
Maintainers
4
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@koopjs/cache-redis - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

.vscode/launch.json

7

CHANGELOG.md

@@ -5,2 +5,8 @@ # Change Log

## [1.0.2] - 2019-04-02
### Fixed
* type checking and handling of `callback` and `options` parameters
* switched to `hmset` method
* parameter order on `hget` method
## [1.0.1] - 2017-08-31

@@ -13,3 +19,4 @@ ### Changed

[1.0.2]: https://github.com/koopjs/koop-cache-redis/compare/v1.0.1..v1.0.2
[1.0.1]: https://github.com/koopjs/koop-cache-redis/compare/v1.0.0..v1.0.1
[1.0.0]: https://github.com/koopjs/koop-cache-redis/releases/tag/v1.0.0

52

dist/index.js

@@ -6,3 +6,3 @@ var redis = require('redis')

var FEATURES = 'koop-cache-redis::features'
var METADATA = 'kooop-cache-redis::metadata'
var METADATA = 'koop-cache-redis::metadata'
var Logger = require('koop-logger')

@@ -12,2 +12,5 @@ var log = new Logger()

// Convenience to make callbacks optional in most functions
function noop () {}
function Cache (options) {

@@ -28,2 +31,6 @@ var this$1 = this;

Cache.name = 'Redis Cache'
Cache.type = 'cache'
Cache.version = require('../package.json').version
Cache.prototype.disconnect = function () {

@@ -33,8 +40,8 @@ this.client.quit()

Cache.prototype.set = function (type, key, value, callback) {
this.client.hset(type, key, JSON.stringify(value), callback)
Cache.prototype.set = function (field, key, value, callback) {
this.client.hmset(key, [field, JSON.stringify(value)], callback)
}
Cache.prototype.get = function (type, key, callback) {
this.client.hget(type, key, function (e, string) {
Cache.prototype.get = function (field, key, callback) {
this.client.hget(key, field, function (e, string) {
callback(e, JSON.parse(string))

@@ -44,6 +51,2 @@ })

Cache.name = 'Redis Cache'
Cache.type = 'cache'
Cache.version = require('../package.json').version
Util.inherits(Cache, EventEmitter)

@@ -54,4 +57,5 @@

if ( options === void 0 ) options = {};
if ( callback === void 0 ) callback = noop;
if (!callback) {
if (typeof options === 'function') {
callback = options

@@ -61,3 +65,3 @@ options = {}

// support a feature collection or an array of features
this.client.hexists(FEATURES, key, function (e, exists) {
this.client.hexists(key, FEATURES, function (e, exists) {
if (e) { return callback(e) }

@@ -79,8 +83,9 @@ else if (exists) { return callback(new Error('Cache key is already in use')) }

if ( options === void 0 ) options = {};
if ( callback === void 0 ) callback = noop;
if (!callback) {
if (typeof options === 'function') {
callback = options
options = {}
}
this.client.hexists(FEATURES, key, function (e, exists) {
this.client.hexists(key, FEATURES, function (e, exists) {
if (e) {

@@ -99,4 +104,5 @@ return callback(e)

if ( options === void 0 ) options = {};
if ( callback === void 0 ) callback = noop;
if (!callback) {
if (typeof options === 'function') {
callback = options

@@ -106,3 +112,3 @@ options = {}

// support a feature collection or an array of features
this.client.hexists(FEATURES, key, function (e, exists) {
this.client.hexists(key, FEATURES, function (e, exists) {
if (e) { return callback(e) }

@@ -126,5 +132,5 @@ else if (!exists) { return callback(new Error('Resource not found')) }

if ( options === void 0 ) options = {};
if ( callback === void 0 ) callback = noop;
// TODO use lists instead of hash keys
if (!callback) {
if (typeof options === 'function') {
callback = options

@@ -145,5 +151,5 @@ options = {}

var this$1 = this;
if ( callback === void 0 ) callback = noop;
// TODO use promise.all
if (!callback) {
if (typeof options === 'function') {
callback = options

@@ -172,3 +178,3 @@ options = {}

// TODO use HEXISTS
this.client.hdel(FEATURES, key, function (e) {
this.client.hdel(key, FEATURES, function (e) {
if (e) { return callback(new Error('Resource not found')) }

@@ -189,3 +195,3 @@ this$1.get(METADATA, key, function (e, metadata) {

this.client.hexists(METADATA, key, function (e, exists) {
this.client.hexists(key, METADATA, function (e, exists) {
if (e) { return callback(e) }

@@ -221,6 +227,6 @@ else if (exists) { return callback(new Error('Catalog key is already in use')) }

this.client.hexists(FEATURES, key, function (e, exists) {
this.client.hexists(key, FEATURES, function (e, exists) {
if (e) { return callback(e) }
else if (exists) { return callback(new Error('Cannot delete catalog entry while data is still in cache')) }
this$1.client.hdel(METADATA, key, function (e) {
this$1.client.hdel(key, METADATA, function (e) {
callback(e)

@@ -227,0 +233,0 @@ })

{
"name": "@koopjs/cache-redis",
"version": "1.0.1",
"version": "1.0.2",
"description": "Redis Cache Plugin for Koop",

@@ -27,3 +27,3 @@ "main": "dist/index.js",

"dependencies": {
"config": "^1.26.2",
"config": "^2.0.0",
"koop-logger": "^1.2.0",

@@ -33,7 +33,7 @@ "redis": "^2.8.0"

"devDependencies": {
"buble": "^0.15.2",
"buble": "^0.19.0",
"standard": "^10.0.3",
"tap-spec": "^4.1.1",
"tap-spec": "^5.0.0",
"tape": "^4.8.0"
}
}

@@ -7,3 +7,3 @@ # Koop Redis Cache

To use this cache:
First: npm install koop-cache-redis
First: npm install @koopjs/cache-redis
Then: configure your host. In your config file

@@ -22,3 +22,3 @@

If using environment variables like
config/custom_environment_variables.json
config/custom-environment-variables.json
```json

@@ -42,3 +42,3 @@ {

const config = require('config')
const cache = require('koop-cache-redis')
const cache = require('@koopjs/cache-redis')
koop.register(cache)

@@ -45,0 +45,0 @@ ```

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