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

zcache

Package Overview
Dependencies
Maintainers
5
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zcache - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

.project

19

lib/RedisConnection.js

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

var deferred = Q.defer()
this._client.setex(key, Math.floor(maxAgeMs / 1000), val, deferred.makeNodeResolver())
this._client.psetex(key, maxAgeMs, val, deferred.makeNodeResolver())

@@ -35,2 +35,19 @@ return deferred.promise

RedisConnection.prototype.mset = function (items, maxAgeMs) {
var deferred = Q.defer()
var msetCommand = ["MSET"]
var commands = [msetCommand]
for (var i = 0, l = items.length; i < l; i++) {
var key = items[i].key
// Append key value arguments to the set command.
msetCommand.push(key, items[i].value)
// Append an expire command.
commands.push(["PEXPIRE", key, maxAgeMs])
}
this._client.multi(commands).exec(deferred.makeNodeResolver())
return deferred.promise
.fail(warnOnError)
}
RedisConnection.prototype.del = function (key) {

@@ -37,0 +54,0 @@ var deferred = Q.defer()

@@ -87,6 +87,12 @@ var util = require('util')

RedundantCacheGroup.prototype.mset = function (items, maxAgeMs) {
var instance = this._getAvailableInstance()
if (!instance) return Q.resolve(undefined)
return instance.mset(items, maxAgeMs)
}
RedundantCacheGroup.prototype.set = function (key, val, maxAgeMs) {
var instances = this._getAllInstances()
var promises = []
for (var i = 0; i < instances.length; i++) {

@@ -93,0 +99,0 @@ promises.push(instances[i].set(key, val, maxAgeMs))

2

package.json
{
"name": "zcache"
, "description": "AWS zone-aware caching"
, "version": "0.2.0"
, "version": "0.2.1"
, "homepage": "https://github.com/azulus/zcache"

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

@@ -47,2 +47,19 @@ var zcache = require('../index')

test.equal(vals[0], undefined)
})
.then(function () {
return cacheInstance.mset([{
key: 'a',
value: '456'
}, {
key: 'b',
value: '789'
}], 300000)
})
.then(function () {
return cacheInstance.mget(['a', 'b'])
})
.then(function (vals) {
test.equal(vals.length, 2, "Should have precisely 2 results")
test.equal(vals[0], '456')
test.equal(vals[1], '789')
cacheInstance.destroy()

@@ -63,2 +80,2 @@ })

cacheInstance.connect()
}
}
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