Comparing version 4.1.0 to 4.1.1
@@ -7,2 +7,6 @@ # Change Log | ||
## [4.1.1] - 2017-08-30 | ||
- Added alias method to `remove`: `destroy` | ||
- Removed unused code | ||
## [4.1.0] - 2017-08-29 | ||
@@ -9,0 +13,0 @@ - Added new method: `removeExpired`, now is possible remove all records expired at once |
@@ -1,2 +0,2 @@ | ||
// [AIV] InCache Build version: 4.1.0 | ||
// [AIV] InCache Build version: 4.1.1 | ||
var incache = | ||
@@ -524,3 +524,2 @@ /******/ (function(modules) { // webpackBootstrap | ||
* @param [silent=false] {boolean} if true no event will be triggered | ||
* @param [opts] {Object} optional arguments | ||
* @example | ||
@@ -534,3 +533,2 @@ * inCache.remove('my key'); | ||
var silent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
@@ -728,3 +726,3 @@ delete this._storage[key]; | ||
for (var i = 0; i < keys.length; i++) { | ||
this.remove(keys[i], true, { fromBulk: true }); | ||
this.remove(keys[i], true); | ||
} | ||
@@ -825,2 +823,18 @@ } | ||
/** | ||
* Alias of `remove` | ||
* @borrows remove as destroy | ||
* @param args | ||
*/ | ||
}, { | ||
key: 'destroy', | ||
value: function destroy() { | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
this.remove.apply(this, args); | ||
} | ||
/** | ||
* Triggered when a record has been deleted | ||
@@ -827,0 +841,0 @@ * @param callback {InCache~removedCallback} callback function |
@@ -1,2 +0,2 @@ | ||
// [AIV] InCache Build version: 4.1.0 | ||
var incache=function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=1)}([function(e,t,r){"use strict";function n(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function o(e){if(f===setTimeout)return setTimeout(e,0);if((f===n||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function a(e){if(h===clearTimeout)return clearTimeout(e);if((h===i||!h)&&clearTimeout)return h=clearTimeout,clearTimeout(e);try{return h(e)}catch(t){try{return h.call(null,e)}catch(t){return h.call(this,e)}}}function s(){p&&v&&(p=!1,v.length?y=v.concat(y):m=-1,y.length&&u())}function u(){if(!p){var e=o(s);p=!0;for(var t=y.length;t;){for(v=y,y=[];++m<t;)v&&v[m].run();m=-1,t=y.length}v=null,p=!1,a(e)}}function l(e,t){this.fun=e,this.array=t}function c(){}var f,h,d=e.exports={};!function(){try{f="function"==typeof setTimeout?setTimeout:n}catch(e){f=n}try{h="function"==typeof clearTimeout?clearTimeout:i}catch(e){h=i}}();var v,y=[],p=!1,m=-1;d.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];y.push(new l(e,t)),1!==y.length||p||o(u)},l.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=c,d.addListener=c,d.once=c,d.off=c,d.removeListener=c,d.removeAllListeners=c,d.emit=c,d.prependListener=c,d.prependOnceListener=c,d.listeners=function(e){return[]},d.binding=function(e){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(e){throw new Error("process.chdir is not supported")},d.umask=function(){return 0}},function(e,t,r){"use strict";e.exports=r(2)},function(e,t,r){"use strict";(function(t,n){function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=r(4),s=r(5),u=function(){function e(){var r=this,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,e),this.GLOBAL_KEY="___InCache___storage___global___key___",this._root=a.isServer()?t:window,this.DEFAULT_CONFIG={storeName:"",save:!0,filePath:".incache",maxAge:0,expires:null,silent:!1,global:{silent:!1,life:0}},this._onRemoved=function(){},this._onCreated=function(){},this._onUpdated=function(){},a.isServer()&&(n.stdin.resume(),n.on("exit",function(){r._write()}),n.on("SIGINT",function(){r._write()})),this.setConfig(o)}return o(e,[{key:"_write",value:function(){var e=this._memory,t=e.config,r=e.data;if(t.save){var n=JSON.stringify(r);s.writeFileSync(t.filePath,n)}}},{key:"_read",value:function(){var e=this._memory.config;if(e.save&&s.existsSync(e.filePath)){var t=s.readFileSync(e.filePath);try{this._storage=this._memory.data=JSON.parse(t)}catch(e){this._storage=this._memory.data={}}}}},{key:"setConfig",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.storeName&&(this.GLOBAL_KEY+=e.storeName),this._root[this.GLOBAL_KEY]||(this._root[this.GLOBAL_KEY]={metadata:{lastSave:null},data:{},config:this.DEFAULT_CONFIG}),e.global&&(a.deprecated(e.global.life,"global.life is deprecated use maxAge instead"),a.deprecated(e.global.silent,"global.silent is deprecated use silent instead")),this._root[this.GLOBAL_KEY].config=a.defaults(e,this.DEFAULT_CONFIG),this._memory=this._root[this.GLOBAL_KEY],this._storage=this._memory.data,a.isServer()&&this._read()}},{key:"getConfig",value:function(){return this._memory.config}},{key:"set",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n={isNew:!0,createdOn:null,updatedOn:null,expiresOn:null,value:t};return r=a.defaults(r,this.DEFAULT_CONFIG),r.expires&&(a.is(r.expires,"date")||a.is(r.expires,"string"))?n.expiresOn=new Date(r.expires):r.maxAge&&a.is(r.maxAge,"number")?n.expiresOn=a.addMSToNow(r.maxAge):r.life&&a.is(r.life,"number")&&(a.deprecated(r.life,"life is deprecated use maxAge instead"),n.expiresOn=a.addSecondsToNow(r.life)),this.has(e)?(n.isNew=!1,n.updatedOn=new Date,r.silent||this._onUpdated.call(this,e,n)):(n.createdOn=new Date,r.silent||this._onCreated.call(this,e,n)),this._storage[e]=n,n}},{key:"get",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.has(e)?this.expired(e)?(this.remove(e,!0),null):t?this._storage[e].value:this._storage[e]:null}},{key:"remove",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];arguments.length>2&&void 0!==arguments[2]&&arguments[2];delete this._storage[e],t||this._onRemoved.call(this,e)}},{key:"removeFrom",value:function(e,t){if(!this.has(e))return null;if(a.is(t,"undefined"))throw new Error("where cannot be undefined");var r=this.get(e);if(!a.is(r,"array"))throw new Error("value must be an array");var n=r.length;for(var i in r)if(r.hasOwnProperty(i)){var o=[];for(var s in t)t.hasOwnProperty(s)&&(a.is(t,"object")?o.push(void 0!==r[i][s]&&r[i][s]===t[s]):o.push(r[i]===t));o.length&&-1===o.indexOf(!1)&&r.splice(i,1)}n!==r.length&&this.set(e,r)}},{key:"removeExpired",value:function(){for(var e in this._storage)this._storage.hasOwnProperty(e)&&this.expired(e)&&this.remove(e,!0)}},{key:"addTo",value:function(e,t){if(!this.has(e))return null;var r=this.get(e);if(!a.is(r,"array"))throw new Error("object must be an array");return r.push(t),this.set(e,r)}},{key:"prependTo",value:function(e,t){if(!this.has(e))return null;var r=this.get(e);if(!a.is(r,"array"))throw new Error("object must be an array");return r.unshift(t),this.set(e,r)}},{key:"updateIn",value:function(e,t,r){if(!this.has(e))return null;if(a.is(t,"undefined"))throw new Error("value cannot be undefined");if(a.is(r,"undefined"))throw new Error("where cannot be undefined");var n=this.get(e);if(!a.is(n,"array"))throw new Error("value must be an array");var i=!1;for(var o in n)if(n.hasOwnProperty(o)){var s=[];for(var u in r)r.hasOwnProperty(u)&&(a.is(r,"object")?s.push(void 0!==n[o][u]&&n[o][u]===r[u]):s.push(n[o]===r));s.length&&-1===s.indexOf(!1)&&(i=!0,n[o]=t)}i&&this.set(e,n)}},{key:"bulkSet",value:function(e){if(!a.is(e,"array"))throw new Error("records must be an array of object, e.g. {key: foo, value: bar}");for(var t=0;t<e.length;t++){if(a.is(e[t].key,"undefined")||a.is(e[t].value,"undefined"))throw new Error("key and value properties are required");this.set(e[t].key,e[t].value,{silent:!0,fromBulk:!0})}}},{key:"bulkRemove",value:function(e){if(!a.is(e,"array"))throw new Error("keys must be an array of keys");for(var t=0;t<e.length;t++)this.remove(e[t],!0,{fromBulk:!0})}},{key:"clean",value:function(e){if(!a.is(e,"string"))throw new Error("key must be a string");for(var t in this._storage)this._storage.hasOwnProperty(t)&&-1!==t.indexOf(e)&&delete this._storage[t]}},{key:"all",value:function(){var e=[];for(var t in this._storage)this._storage.hasOwnProperty(t)&&(this.expired(t)?this.remove(t,!0):e.push({key:t,value:this._storage[t].value}));return e}},{key:"expired",value:function(e){if(this._storage[e]&&this._storage[e].expiresOn){return new Date>new Date(this._storage[e].expiresOn)}return!1}},{key:"clear",value:function(){this._storage=this._memory.data={}}},{key:"has",value:function(e){return this._storage.hasOwnProperty(e)}},{key:"onRemoved",value:function(e){this._onRemoved=e}},{key:"onCreated",value:function(e){this._onCreated=e}},{key:"onUpdated",value:function(e){this._onUpdated=e}}]),e}();e.exports=u}).call(t,r(3),r(0))},function(e,t,r){"use strict";var n,i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"===("undefined"==typeof window?"undefined":i(window))&&(n=window)}e.exports=n},function(e,t,r){"use strict";(function(t){var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n={};n.is=function(e,t){return Object.prototype.toString.call(e).toLowerCase()==="[object "+t+"]".toLowerCase()},n.defaults=function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e.hasOwnProperty(i)?"object"===r(e[i])&&n.defaults(e[i],t[i]):e[i]=t[i]);return e},n.addSecondsToNow=function(e){var t=new Date;return new Date(t.setSeconds(t.getSeconds()+e))},n.addMSToNow=function(e){var t=new Date;return new Date(t.setMilliseconds(t.getMilliseconds()+e))},n.isServer=function(){return"object"===(void 0===t?"undefined":r(t))&&void 0!==t.pid},n.deprecated=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"warn";return void 0!==e&&(console[r](t||e),!0)},e.exports=n}).call(t,r(0))},function(e,t,r){"use strict"}]); | ||
// [AIV] InCache Build version: 4.1.1 | ||
var incache=function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=1)}([function(e,t,r){"use strict";function n(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function o(e){if(f===setTimeout)return setTimeout(e,0);if((f===n||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function a(e){if(h===clearTimeout)return clearTimeout(e);if((h===i||!h)&&clearTimeout)return h=clearTimeout,clearTimeout(e);try{return h(e)}catch(t){try{return h.call(null,e)}catch(t){return h.call(this,e)}}}function s(){p&&v&&(p=!1,v.length?y=v.concat(y):m=-1,y.length&&u())}function u(){if(!p){var e=o(s);p=!0;for(var t=y.length;t;){for(v=y,y=[];++m<t;)v&&v[m].run();m=-1,t=y.length}v=null,p=!1,a(e)}}function l(e,t){this.fun=e,this.array=t}function c(){}var f,h,d=e.exports={};!function(){try{f="function"==typeof setTimeout?setTimeout:n}catch(e){f=n}try{h="function"==typeof clearTimeout?clearTimeout:i}catch(e){h=i}}();var v,y=[],p=!1,m=-1;d.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];y.push(new l(e,t)),1!==y.length||p||o(u)},l.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=c,d.addListener=c,d.once=c,d.off=c,d.removeListener=c,d.removeAllListeners=c,d.emit=c,d.prependListener=c,d.prependOnceListener=c,d.listeners=function(e){return[]},d.binding=function(e){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(e){throw new Error("process.chdir is not supported")},d.umask=function(){return 0}},function(e,t,r){"use strict";e.exports=r(2)},function(e,t,r){"use strict";(function(t,n){function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=r(4),s=r(5),u=function(){function e(){var r=this,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,e),this.GLOBAL_KEY="___InCache___storage___global___key___",this._root=a.isServer()?t:window,this.DEFAULT_CONFIG={storeName:"",save:!0,filePath:".incache",maxAge:0,expires:null,silent:!1,global:{silent:!1,life:0}},this._onRemoved=function(){},this._onCreated=function(){},this._onUpdated=function(){},a.isServer()&&(n.stdin.resume(),n.on("exit",function(){r._write()}),n.on("SIGINT",function(){r._write()})),this.setConfig(o)}return o(e,[{key:"_write",value:function(){var e=this._memory,t=e.config,r=e.data;if(t.save){var n=JSON.stringify(r);s.writeFileSync(t.filePath,n)}}},{key:"_read",value:function(){var e=this._memory.config;if(e.save&&s.existsSync(e.filePath)){var t=s.readFileSync(e.filePath);try{this._storage=this._memory.data=JSON.parse(t)}catch(e){this._storage=this._memory.data={}}}}},{key:"setConfig",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.storeName&&(this.GLOBAL_KEY+=e.storeName),this._root[this.GLOBAL_KEY]||(this._root[this.GLOBAL_KEY]={metadata:{lastSave:null},data:{},config:this.DEFAULT_CONFIG}),e.global&&(a.deprecated(e.global.life,"global.life is deprecated use maxAge instead"),a.deprecated(e.global.silent,"global.silent is deprecated use silent instead")),this._root[this.GLOBAL_KEY].config=a.defaults(e,this.DEFAULT_CONFIG),this._memory=this._root[this.GLOBAL_KEY],this._storage=this._memory.data,a.isServer()&&this._read()}},{key:"getConfig",value:function(){return this._memory.config}},{key:"set",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n={isNew:!0,createdOn:null,updatedOn:null,expiresOn:null,value:t};return r=a.defaults(r,this.DEFAULT_CONFIG),r.expires&&(a.is(r.expires,"date")||a.is(r.expires,"string"))?n.expiresOn=new Date(r.expires):r.maxAge&&a.is(r.maxAge,"number")?n.expiresOn=a.addMSToNow(r.maxAge):r.life&&a.is(r.life,"number")&&(a.deprecated(r.life,"life is deprecated use maxAge instead"),n.expiresOn=a.addSecondsToNow(r.life)),this.has(e)?(n.isNew=!1,n.updatedOn=new Date,r.silent||this._onUpdated.call(this,e,n)):(n.createdOn=new Date,r.silent||this._onCreated.call(this,e,n)),this._storage[e]=n,n}},{key:"get",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.has(e)?this.expired(e)?(this.remove(e,!0),null):t?this._storage[e].value:this._storage[e]:null}},{key:"remove",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];delete this._storage[e],t||this._onRemoved.call(this,e)}},{key:"removeFrom",value:function(e,t){if(!this.has(e))return null;if(a.is(t,"undefined"))throw new Error("where cannot be undefined");var r=this.get(e);if(!a.is(r,"array"))throw new Error("value must be an array");var n=r.length;for(var i in r)if(r.hasOwnProperty(i)){var o=[];for(var s in t)t.hasOwnProperty(s)&&(a.is(t,"object")?o.push(void 0!==r[i][s]&&r[i][s]===t[s]):o.push(r[i]===t));o.length&&-1===o.indexOf(!1)&&r.splice(i,1)}n!==r.length&&this.set(e,r)}},{key:"removeExpired",value:function(){for(var e in this._storage)this._storage.hasOwnProperty(e)&&this.expired(e)&&this.remove(e,!0)}},{key:"addTo",value:function(e,t){if(!this.has(e))return null;var r=this.get(e);if(!a.is(r,"array"))throw new Error("object must be an array");return r.push(t),this.set(e,r)}},{key:"prependTo",value:function(e,t){if(!this.has(e))return null;var r=this.get(e);if(!a.is(r,"array"))throw new Error("object must be an array");return r.unshift(t),this.set(e,r)}},{key:"updateIn",value:function(e,t,r){if(!this.has(e))return null;if(a.is(t,"undefined"))throw new Error("value cannot be undefined");if(a.is(r,"undefined"))throw new Error("where cannot be undefined");var n=this.get(e);if(!a.is(n,"array"))throw new Error("value must be an array");var i=!1;for(var o in n)if(n.hasOwnProperty(o)){var s=[];for(var u in r)r.hasOwnProperty(u)&&(a.is(r,"object")?s.push(void 0!==n[o][u]&&n[o][u]===r[u]):s.push(n[o]===r));s.length&&-1===s.indexOf(!1)&&(i=!0,n[o]=t)}i&&this.set(e,n)}},{key:"bulkSet",value:function(e){if(!a.is(e,"array"))throw new Error("records must be an array of object, e.g. {key: foo, value: bar}");for(var t=0;t<e.length;t++){if(a.is(e[t].key,"undefined")||a.is(e[t].value,"undefined"))throw new Error("key and value properties are required");this.set(e[t].key,e[t].value,{silent:!0,fromBulk:!0})}}},{key:"bulkRemove",value:function(e){if(!a.is(e,"array"))throw new Error("keys must be an array of keys");for(var t=0;t<e.length;t++)this.remove(e[t],!0)}},{key:"clean",value:function(e){if(!a.is(e,"string"))throw new Error("key must be a string");for(var t in this._storage)this._storage.hasOwnProperty(t)&&-1!==t.indexOf(e)&&delete this._storage[t]}},{key:"all",value:function(){var e=[];for(var t in this._storage)this._storage.hasOwnProperty(t)&&(this.expired(t)?this.remove(t,!0):e.push({key:t,value:this._storage[t].value}));return e}},{key:"expired",value:function(e){if(this._storage[e]&&this._storage[e].expiresOn){return new Date>new Date(this._storage[e].expiresOn)}return!1}},{key:"clear",value:function(){this._storage=this._memory.data={}}},{key:"has",value:function(e){return this._storage.hasOwnProperty(e)}},{key:"destroy",value:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];this.remove.apply(this,t)}},{key:"onRemoved",value:function(e){this._onRemoved=e}},{key:"onCreated",value:function(e){this._onCreated=e}},{key:"onUpdated",value:function(e){this._onUpdated=e}}]),e}();e.exports=u}).call(t,r(3),r(0))},function(e,t,r){"use strict";var n,i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"===("undefined"==typeof window?"undefined":i(window))&&(n=window)}e.exports=n},function(e,t,r){"use strict";(function(t){var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n={};n.is=function(e,t){return Object.prototype.toString.call(e).toLowerCase()==="[object "+t+"]".toLowerCase()},n.defaults=function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e.hasOwnProperty(i)?"object"===r(e[i])&&n.defaults(e[i],t[i]):e[i]=t[i]);return e},n.addSecondsToNow=function(e){var t=new Date;return new Date(t.setSeconds(t.getSeconds()+e))},n.addMSToNow=function(e){var t=new Date;return new Date(t.setMilliseconds(t.getMilliseconds()+e))},n.isServer=function(){return"object"===(void 0===t?"undefined":r(t))&&void 0!==t.pid},n.deprecated=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"warn";return void 0!==e&&(console[r](t||e),!0)},e.exports=n}).call(t,r(0))},function(e,t,r){"use strict"}]); |
{ | ||
"name": "incache", | ||
"version": "4.1.0", | ||
"version": "4.1.1", | ||
"description": "Simple key/value in-memory storage or on disk to persist some data", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -219,7 +219,6 @@ const helper = require('./helper'); | ||
* @param [silent=false] {boolean} if true no event will be triggered | ||
* @param [opts] {Object} optional arguments | ||
* @example | ||
* inCache.remove('my key'); | ||
*/ | ||
remove(key, silent = false, opts = {}) { | ||
remove(key, silent = false) { | ||
delete this._storage[key]; | ||
@@ -416,3 +415,3 @@ if (!silent) | ||
for (let i = 0; i < keys.length; i++) { | ||
this.remove(keys[i], true, {fromBulk: true}); | ||
this.remove(keys[i], true); | ||
} | ||
@@ -500,2 +499,11 @@ } | ||
/** | ||
* Alias of `remove` | ||
* @borrows remove as destroy | ||
* @param args | ||
*/ | ||
destroy(...args) { | ||
this.remove.apply(this, args); | ||
} | ||
/** | ||
* Triggered when a record has been deleted | ||
@@ -502,0 +510,0 @@ * @param callback {InCache~removedCallback} callback function |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
68664
1448