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

basiccache

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

basiccache - npm Package Compare versions

Comparing version 0.0.1 to 0.0.3

examples/clear.js

12

basiccache.js

@@ -53,3 +53,3 @@ /**

/**
* remove an item from the cach
* remove an item from the cache
*/

@@ -61,2 +61,12 @@ BasicCache.prototype.remove = function(key) {

/**
* clear all items from the cache
*/
BasicCache.prototype.clear = function() {
for (var key in this.cache) {
if (!this.cache.hasOwnProperty(key)) continue;
delete this.cache[key];
}
};
/**
* internal debug function

@@ -63,0 +73,0 @@ */

2

basiccache.min.js

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

function BasicCache(e){this.opts=e||{},this.cache={}}"undefined"!=typeof exports&&(module.exports=BasicCache),BasicCache.prototype.get=function(e){var c=Date.now();return void 0===this.cache[e]?(this.debug('failed to pull "'+e+'" from cache'),void 0):c>this.cache[e].invalid?(this.debug('key "'+e+'" expired at: '+this.cache[e].invalid),delete this.cache[e],void 0):(this.debug('key "'+e+'" pulled from cache'),this.cache[e].value)},BasicCache.prototype.set=function(e,c,t){var i=Date.now()+(t||3e5);return this.cache[e]={},this.cache[e].value=c,this.cache[e].invalid=i,this.cache[e].invalid},BasicCache.prototype.remove=function(e){delete this.cache[e]},BasicCache.prototype.debug=function(){this.opts.debug&&console.log.apply(console,arguments)};
function BasicCache(e){this.opts=e||{},this.cache={}}"undefined"!=typeof exports&&(module.exports=BasicCache),BasicCache.prototype.get=function(e){var c=Date.now();return void 0===this.cache[e]?(this.debug('failed to pull "'+e+'" from cache'),void 0):c>this.cache[e].invalid?(this.debug('key "'+e+'" expired at: '+this.cache[e].invalid),delete this.cache[e],void 0):(this.debug('key "'+e+'" pulled from cache'),this.cache[e].value)},BasicCache.prototype.set=function(e,c,t){var a=Date.now()+(t||3e5);return this.cache[e]={},this.cache[e].value=c,this.cache[e].invalid=a,this.cache[e].invalid},BasicCache.prototype.remove=function(e){delete this.cache[e]},BasicCache.prototype.clear=function(){for(var e in this.cache)this.cache.hasOwnProperty(e)&&delete this.cache[e]},BasicCache.prototype.debug=function(){this.opts.debug&&console.log.apply(console,arguments)};
{
"name": "basiccache",
"description": "An extremely basic cache with a simple expiry system",
"version": "0.0.1",
"version": "0.0.3",
"author": "Dave Eddy <dave@daveeddy.com> (http://www.daveeddy.com)",

@@ -6,0 +6,0 @@ "main": "./basiccache.js",

@@ -72,2 +72,6 @@ basiccache.js

### cache.clear()
remove all entries from the cache
License

@@ -74,0 +78,0 @@ -------

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