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

core.io-cache-redis

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

core.io-cache-redis - npm Package Compare versions

Comparing version 0.13.0 to 0.14.0

FLOW.md

35

lib/cacheBatch.js

@@ -65,7 +65,9 @@ const extend = require('gextend');

const useCache = hasCacheKeys(getKeys);
/**
* Query the keys that passed
* shouldQueryCache:
* If we have any non-null keys
* then get them from cache
*/
if (hasCacheKeys(getKeys)) {
if (useCache) {
cachedValues = await this.getBatch(getKeys, [], options);

@@ -76,3 +78,3 @@ }

* If all keys were found in
* the cache. Return values...
* the cache return values.
*/

@@ -101,3 +103,3 @@ if (notEmpty(cachedValues) === rawKeys.length) {

const fetchKeys = hasCacheKeys(getKeys) ? batchKeys : rawKeys;
const fetchKeys = useCache ? batchKeys : rawKeys;

@@ -143,3 +145,7 @@ try {

if (hasCacheKeys(getKeys)) {
if (useCache) {
/**
* Combine cached values and
* fetched values for our result.
*/
fetchKeys.forEach((key, index) => {

@@ -151,2 +157,7 @@ const cachedIndex = values[key];

} else {
/**
* If we didn't hit the cache
* fetchKeys should be all
* original keys.
*/
values = results;

@@ -214,4 +225,8 @@ }

setBatch(keys, values, o = {}) {
if (notValidArguments(keys, values)) {
throw new CacheClientError('Argument error', 400);
throw new CacheClientError(
getMessage(keys, values, 'Argument error'),
400
);
}

@@ -224,3 +239,3 @@

keys = this.hashKeyBatch(keys);
keys = this.hashKeyBatch(keys, o);

@@ -273,2 +288,6 @@ const tx = this.client.multi();

return a.filter(a => a != null).length;
}
function getMessage(keys, values, msg) {
return `${msg}: keys ${keys.length} values ${values.length}`;
}
{
"name": "core.io-cache-redis",
"version": "0.13.0",
"version": "0.14.0",
"description": "Redis cache module",

@@ -5,0 +5,0 @@ "main": "index.js",

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