New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@aofl/cache-manager

Package Overview
Dependencies
Maintainers
2
Versions
145
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aofl/cache-manager - npm Package Compare versions

Comparing version 3.0.0-alpha.11 to 3.0.0-beta.1

6

index.js
/**
* Exports CacheManager, cacheTypeEnumerate, and MemoryStorage
*
* @module aofl-js/cache-manager-package
* @version 1.0.0
* @module @aofl/cache-manager
* @version 3.0.0
* @since 1.0.0
* @author Arian Khosravi <arian.khosravi@aofl.com>
*/
import CacheManager from './modules/cache-manager';

@@ -10,0 +10,0 @@ import {cacheTypeEnumerate} from './modules/cache-type-enumerate';

@@ -0,1 +1,6 @@

/**
* @summary cache-manager
* @version 1.0.0
* @author Arian Khosravi <arian.khosravi@aofl.com>
*/
import {cacheTypeEnumerate} from '../cache-type-enumerate';

@@ -13,14 +18,9 @@ import MemoryStorage from '../memory-storage';

const EXPIRE_SYMBOL = Symbol('expire');
/**
* Provides a unified class for storing objects in Storage-like Objects. You can choose from
* Provides a unified class for storing objects in Storage-like Objects. You can choose from
* localStorage, sessionStorage and memoryStorage.
*
* @summary cache-manager
* @version 1.0.0
* @author Arian Khosravi <arian.khosravi@aofl.com>
* @memberof module:aofl-js/cache-manager-package
*
* @requires module:aofl-js/cache-manager-package/src/cache-type-enumerate
* @requires module:aofl-js/cache-manager-package/src/memory-storage
* @requires tiny-js-md5/md5
* @memberof module:@aofl/cache-manager
*/

@@ -37,11 +37,23 @@ class CacheManager {

this.storageType = storageType;
this.expire = expire;
this.namespace = namespace;
this.storedKeys = this.getStoredKeys();
if (expire > 0 && expire < MAX_SIGNED_INT) {
this.interval = setInterval(() => this.removeExpired(), expire);
this.expire = expire;
}
get expire() {
return this[EXPIRE_SYMBOL];
}
set expire(value) {
this[EXPIRE_SYMBOL] = value;
if (this.interval !== null) {
clearInterval(this.interval);
}
if (value > 0 && value < MAX_SIGNED_INT) {
this.interval = setInterval(() => this.removeExpired(), value);
}
}
/**

@@ -48,0 +60,0 @@ * The size read-only property of the Storage interface returns an integer representing the

@@ -5,15 +5,26 @@ /**

* @summary cache-type-enumerate
* @version 1.0.0
* @version 3.0.0
* @since 1.0.0
* @author Arian Khosravi <arian.khosravi@aofl.com>
* @memberof module:aofl-js/cache-manager-package
*/
/**
* Cache types enumerate
*
* @memberof module:@aofl/cache-manager
* @readonly
* @static
* @enum {Number}
*/
const cacheTypeEnumerate = {
/** memoryStorage */
MEMORY: 0,
/** localStorage */
LOCAL: 1,
/** sessionStorage */
SESSION: 2
};
export {
cacheTypeEnumerate
};
/**
* Implements a new Storage type that has the same api as Storage (local, session) except for key().
* Due to compatibility issues with IE, the size property is implemented instead of length.
*
* @summary server-environment
* @version 1.0.0
* @version 3.0.0
* @since 1.0.0
* @author Arian Khosravi <arian.khosravi@aofl.com>
* @memberof module:aofl-js/cache-manager-package
*/
/**
*
*
* @memberof module:@aofl/cache-manager
*/
class MemoryStorage {

@@ -11,0 +15,0 @@ /**

{
"name": "@aofl/cache-manager",
"version": "3.0.0-alpha.11",
"version": "3.0.0-beta.1",
"description": "Provides a unified class for storing objects in Storage-like Objects",

@@ -28,4 +28,3 @@ "main": "index.js",

"tiny-js-md5": "^1.1.2"
},
"gitHead": "ecdfe7e68c95cd3ce9eca2c86626275d1d4559fe"
}
}
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