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

koatty_store

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koatty_store - npm Package Compare versions

Comparing version 1.4.6 to 1.4.7

1

dist/index.d.ts

@@ -37,2 +37,3 @@ import { MemoryStore } from "./memory";

set(name: string, value: string | number, timeout?: number): Promise<any>;
del(name: string): Promise<any>;
defineCommand(name: string, scripts: any): any;

@@ -39,0 +40,0 @@ getCompare(name: string, value: string | number): Promise<any>;

2

dist/index.js

@@ -8,3 +8,3 @@ "use strict";

* @LastEditors: Please set LastEditors
* @LastEditTime: 2021-06-30 17:00:57
* @LastEditTime: 2021-07-01 11:03:36
* @License: BSD (3-Clause)

@@ -11,0 +11,0 @@ * @Copyright (c) - <richenlin(at)gmail.com>

@@ -22,4 +22,4 @@ import { CacheStore, StoreOptions } from ".";

/**
* getConnection
*
*
* @returns {*}

@@ -30,4 +30,4 @@ * @memberof MemoryStore

/**
* close
*
*
* @returns {*} {Promise<void>}

@@ -38,4 +38,4 @@ * @memberof MemoryStore

/**
* release
*
*
* @param {*} conn

@@ -47,4 +47,4 @@ * @returns {*} {Promise<void>}

/**
* defineCommand
*
*
* @param {string} name

@@ -56,4 +56,4 @@ * @param {*} scripts

/**
* get and compare value
*
*
* @param {string} name

@@ -66,4 +66,4 @@ * @param {(string | number)} value

/**
* get
*
*
* @param {string} name

@@ -75,4 +75,4 @@ * @returns {*} {Promise<any>}

/**
* set
*
*
* @param {string} name

@@ -85,2 +85,10 @@ * @param {(string | number)} value

set(name: string, value: string | number, timeout?: number): Promise<any>;
/**
* del
*
* @param {string} name
* @returns {*}
* @memberof MemoryStore
*/
del(name: string): any;
}

@@ -25,4 +25,4 @@ "use strict";

/**
* getConnection
*
*
* @returns {*}

@@ -42,4 +42,4 @@ * @memberof MemoryStore

/**
* close
*
*
* @returns {*} {Promise<void>}

@@ -53,4 +53,4 @@ * @memberof MemoryStore

/**
* release
*
*
* @param {*} conn

@@ -64,4 +64,4 @@ * @returns {*} {Promise<void>}

/**
* defineCommand
*
*
* @param {string} name

@@ -84,4 +84,4 @@ * @param {*} scripts

/**
* get and compare value
*
*
* @param {string} name

@@ -106,4 +106,4 @@ * @param {(string | number)} value

/**
* get
*
*
* @param {string} name

@@ -118,4 +118,4 @@ * @returns {*} {Promise<any>}

/**
* set
*
*
* @param {string} name

@@ -127,3 +127,3 @@ * @param {(string | number)} value

*/
async set(name, value, timeout) {
set(name, value, timeout) {
const client = this.getConnection();

@@ -135,4 +135,15 @@ if (helper.isTrueEmpty(timeout)) {

}
/**
* del
*
* @param {string} name
* @returns {*}
* @memberof MemoryStore
*/
del(name) {
const client = this.getConnection();
return client.delAsync(name);
}
}
exports.MemoryStore = MemoryStore;
//# sourceMappingURL=memory.js.map

@@ -90,4 +90,4 @@ import IORedis from "ioredis";

/**
* get and compare value
*
*
* @param {string} name

@@ -94,0 +94,0 @@ * @param {(string | number)} value

@@ -9,3 +9,3 @@ "use strict";

* @LastEditors: Please set LastEditors
* @LastEditTime: 2021-06-30 17:04:33
* @LastEditTime: 2021-07-01 11:05:20
* @License: BSD (3-Clause)

@@ -192,4 +192,4 @@ * @Copyright (c) - <richenlin(at)gmail.com>

/**
* get and compare value
*
*
* @param {string} name

@@ -201,17 +201,26 @@ * @param {(string | number)} value

async getCompare(name, value) {
const conn = await this.defineCommand("getCompare", {
numberOfKeys: 1,
lua: `
local remote_value = redis.call("get",KEYS[1])
if (not remote_value) then
return 0
elseif (remote_value == ARGV[1]) then
return redis.call("del",KEYS[1])
else
return -1
end
`
});
return conn.getCompare(name, value);
let conn;
try {
conn = await this.defineCommand("getCompare", {
numberOfKeys: 1,
lua: `
local remote_value = redis.call("get",KEYS[1])
if (not remote_value) then
return 0
elseif (remote_value == ARGV[1]) then
return redis.call("del",KEYS[1])
else
return -1
end
`
});
return conn.getCompare(name, value);
}
catch (error) {
throw error;
}
finally {
this.release(conn);
}
}

@@ -218,0 +227,0 @@ /**

{
"name": "koatty_store",
"version": "1.4.6",
"version": "1.4.7",
"description": "Cache store for koatty.",

@@ -87,2 +87,2 @@ "scripts": {

}
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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