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

zcache

Package Overview
Dependencies
Maintainers
7
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.3.0-alpha to 0.3.0-beta

1

index.js

@@ -12,3 +12,4 @@ module.exports = {

TimeoutError: require('./lib/TimeoutError'),
PartialResultError: require('./lib/PartialResultError'),
MultiWriteCacheGroup: require('./lib/MultiWriteCacheGroup')
}

@@ -13,2 +13,3 @@ // Copyright 2014 The Obvious Corporation.

var TimeoutError = require('./TimeoutError')
var metrics = require('metrics')

@@ -30,2 +31,3 @@ /**

this._targetCapacities = {}
this._partialFailureCount = {}
this._hashRing = null

@@ -135,2 +137,3 @@ }

} else {
self.getPartialFailureCount('mget').inc()
throw new PartialResultError(values, errors)

@@ -181,2 +184,3 @@ }

if (Object.keys(errors).length > 0) {
self.getPartialFailureCount('mset').inc()
throw new PartialResultError({}, errors)

@@ -196,2 +200,13 @@ }

/**
* Get the partial failure count of a certain operation.
*
* @param {string} op The name of the operation, e.g., mget or mset.
* @return {metrics.Counter}
*/
CacheCluster.prototype.getPartialFailureCount = function (op) {
if (!this._partialFailureCount[op]) this._partialFailureCount[op] = new metrics.Counter()
return this._partialFailureCount[op]
}
/**
* Wrap a promise and add two more features to it - latency measurement and timeout.

@@ -198,0 +213,0 @@ *

7

lib/RedisConnection.js

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

* 'mget', 'set', 'mset' and 'del'.
* @param {string} timeoutMsg The message to throw if timeout happens.
* @param {string} opDesc A short description of the operation
* @return {function(Object, Object)} A node-style callback function.
*/
RedisConnection.prototype._makeNodeResolverWithTimeout = function (deferred, opName, timeoutMsg) {
RedisConnection.prototype._makeNodeResolverWithTimeout = function (deferred, opName, opDesc) {
// Indicates if this request has already timeout

@@ -191,3 +191,3 @@ var isTimeout = false

var timeout = setTimeout(function() {
deferred.reject(new TimeoutError(timeoutMsg))
deferred.reject(new TimeoutError('Cache request timeout. ' + opDesc))
isTimeout = true

@@ -201,2 +201,3 @@ self.getTimeoutCount(opName).inc()

clearTimeout(timeout)
// TODO(Xiao): integrate opDesc into the error.
if (err) deferred.reject(err)

@@ -203,0 +204,0 @@ else deferred.resolve(data)

{
"name": "zcache",
"description": "AWS zone-aware multi-layer cache",
"version": "0.3.0-alpha",
"version": "0.3.0-beta",
"homepage": "https://github.com/Obvious/zcache",

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

@@ -107,2 +107,3 @@ // Copyright 2014 The Obvious Corporation.

test.ok(err instanceof PartialResultError)
test.equal(1, cluster.getPartialFailureCount('mget').count)
var data = err.getData()

@@ -146,2 +147,3 @@ var error = err.getError()

test.ok(err instanceof PartialResultError)
test.equal(1, cluster.getPartialFailureCount('mset').count)
var data = err.getData()

@@ -148,0 +150,0 @@ var error = err.getError()

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