You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

caccl-memory-store

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0-beta.0 to 2.0.0-beta.1

3

lib/CACCLMemoryStore.d.ts

@@ -30,5 +30,6 @@ import CACCLStore from './CACCLStore';

* @param value JSON value object
* @returns previously stored value if there was one
*/
set(key: string, value: object): Promise<void>;
set(key: string, value: object): Promise<object | undefined>;
}
export default CACCLMemoryStore;

@@ -101,2 +101,3 @@ "use strict";

* @param value JSON value object
* @returns previously stored value if there was one
*/

@@ -107,8 +108,12 @@ CACCLMemoryStore.prototype.set = function (key, value) {

return __generator(this, function (_a) {
// Set in primary store
this.mutex.lock(function () {
_this.primaryStore.set(key, value);
_this.mutex.unlock();
});
return [2 /*return*/];
return [2 /*return*/, new Promise(function (resolve) {
// Set in primary store
_this.mutex.lock(function () {
var prevValue = _this.get(key);
_this.primaryStore.set(key, value);
_this.mutex.unlock();
// Finish
resolve(prevValue !== null && prevValue !== void 0 ? prevValue : undefined);
});
})];
});

@@ -115,0 +120,0 @@ });

@@ -12,5 +12,6 @@ interface CACCLStore {

* @param value
* @returns previously stored value if there was one
*/
set(key: string, value: object): Promise<void>;
set(key: string, value: object): Promise<object | undefined>;
}
export default CACCLStore;
{
"name": "caccl-memory-store",
"version": "2.0.0-beta.0",
"version": "2.0.0-beta.1",
"description": "CACCL's memory store for credential storage and caching",

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

@@ -68,8 +68,15 @@ // Import libs

* @param value JSON value object
* @returns previously stored value if there was one
*/
public async set(key: string, value: object) {
// Set in primary store
this.mutex.lock(() => {
this.primaryStore.set(key, value);
this.mutex.unlock();
public async set(key: string, value: object): Promise<object | undefined> {
return new Promise((resolve) => {
// Set in primary store
this.mutex.lock(() => {
const prevValue = this.get(key);
this.primaryStore.set(key, value);
this.mutex.unlock();
// Finish
resolve(prevValue ?? undefined);
});
});

@@ -76,0 +83,0 @@ }

@@ -13,6 +13,7 @@ interface CACCLStore {

* @param value
* @returns previously stored value if there was one
*/
set(key: string, value: object): Promise<void>;
set(key: string, value: object): Promise<object | undefined>;
}
export default CACCLStore;

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc