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

@appolo/cache

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@appolo/cache - npm Package Compare versions

Comparing version 0.0.3 to 0.0.34

15

module/src/cache.js

@@ -28,2 +28,15 @@ "use strict";

}
async del(...args) {
let key = this._getKey(args);
this._cache.del(key);
if (this._options.db) {
let redisKey = this._getRedisKey(key);
await this.redisProvider.del(redisKey);
}
}
async set(value, ...args) {
let key = this._getKey(args);
this._setMemoryValue(key, value);
await this._setRedisValue(key, value);
}
_getSync(args, key) {

@@ -132,3 +145,3 @@ let item = this._getValueFromMemory(args, key);

let redisKey = this._getRedisKey(key), age = this._getRedisMaxAge();
(this._options.maxAge ? this.redisProvider.setWithExpire(redisKey, value, age) : this.redisProvider.set(redisKey, value))
return (this._options.maxAge ? this.redisProvider.setWithExpire(redisKey, value, age) : this.redisProvider.set(redisKey, value))
.catch(e => this.logger.error(`failed to set redis cache ${key}`, { e }));

@@ -135,0 +148,0 @@ }

@@ -48,2 +48,22 @@ import {define, initMethod, inject, injectLazy} from 'appolo';

public async del(...args: any[]): Promise<void> {
let key = this._getKey(args);
this._cache.del(key);
if (this._options.db) {
let redisKey = this._getRedisKey(key);
await this.redisProvider.del(redisKey);
}
}
public async set(value: any, ...args: any[]): Promise<void> {
let key = this._getKey(args);
this._setMemoryValue(key, value);
await this._setRedisValue(key, value);
}
private _getSync(args: any[], key: string) {

@@ -199,3 +219,3 @@

(this._options.maxAge ? this.redisProvider.setWithExpire(redisKey, value, age) : this.redisProvider.set(redisKey, value))
return (this._options.maxAge ? this.redisProvider.setWithExpire(redisKey, value, age) : this.redisProvider.set(redisKey, value))
.catch(e => this.logger.error(`failed to set redis cache ${key}`, {e}))

@@ -202,0 +222,0 @@

6

package.json
{
"name": "@appolo/cache",
"version": "0.0.3",
"version": "0.0.34",
"description": "appolo cache module",

@@ -14,4 +14,4 @@ "publishConfig": {

"dependencies": {
"@appolo/logger": "0.0.14",
"@appolo/redis": "0.0.1",
"@appolo/logger": "^0.0.14",
"@appolo/redis": "^0.0.2",
"appolo": "^6.0.59",

@@ -18,0 +18,0 @@ "bluebird": "^3.5.3",

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