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

@swarmy/lru-cache

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@swarmy/lru-cache - npm Package Compare versions

Comparing version 3.2.0 to 3.2.1

2

build/lru-cache.js

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

module.exports=function(t){var r={};function u(e){if(r[e])return r[e].exports;var n=r[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,u),n.l=!0,n.exports}return u.m=t,u.c=r,u.d=function(e,n,t){u.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:t})},u.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.t=function(n,e){if(1&e&&(n=u(n)),8&e)return n;if(4&e&&"object"==typeof n&&n&&n.__esModule)return n;var t=Object.create(null);if(u.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:n}),2&e&&"string"!=typeof n)for(var r in n)u.d(t,r,function(e){return n[e]}.bind(null,r));return t},u.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(n,"a",n),n},u.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},u.p="",u(u.s=0)}([function(e,n,t){"use strict";t.r(n);var l=function(e,n){null===n.newest?(n.newest=e,n.oldest=e):((n.newest.next=e).prev=n.newest,n.newest=e)},i=function(e,n){e!==n.newest&&(null===(n.newest.next=e).prev?(e.prev=n.newest,e.next.prev=null,n.oldest=e.next):(e.prev.next=e.next,e.next.prev=e.prev,e.prev=n.newest),e.next=null,n.newest=e)},r=function(e,n,t){null===e.next?n.newest=e.prev:e.next.prev=e.prev,null===e.prev?n.oldest=e.next:e.prev.next=e.next,t.delete(e.key)},c=function(e,n,t){var r,u,o,a=[];if(null===e)return a;for(;t.size>e;)a.push((u=t,void 0,o=(r=n).oldest,u.delete(r.oldest.key),r.oldest=r.oldest.next,r.oldest.prev=null,{key:o.key,value:o.value}));return a};function d(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,n=this instanceof d?this:Object.create(d.prototype),u=e;0===u&&(u=null);var o=new Map,a={newest:null,oldest:null};return n.setMaxSize=function(e){return(u=e)<1&&(u=null),c(u,a,o)},n.getMaxSize=function(){return u},n.getSize=function(){return o.size},n.set=function(e,n){var t=o.get(e);if(void 0!==t)return t.value=n,i(t,a),null;t={key:e,value:n,next:null,prev:null},o.set(e,t),l(t,a);var r=c(u,a,o);return 1===r.length?r[0]:null},n.get=function(e){var n=o.get(e);return void 0===n?n:(i(n,a),n.value)},n.getWithoutLruChange=function(e){var n=o.get(e);return void 0===n?n:n.value},n.has=function(e){return o.has(e)},n.delete=function(e){var n=o.get(e);return void 0!==n&&(r(n,a,o),!0)},n.forEach=function(e){for(var n=a.oldest;null!==n;)e(n.value,n.key),n=n.next},n.map=function(e){for(var n=a.oldest,t=[];null!==n;)t.push(e(n.value,n.key)),n=n.next;return t},n.clear=function(){var e=n.map(function(e,n){return{key:n,value:e}});return o.clear(),a.newest=null,a.oldest=null,e},n}function y(e){return function(e){if(Array.isArray(e)){for(var n=0,t=new Array(e.length);n<e.length;n++)t[n]=e[n];return t}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function a(n){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{},r=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.forEach(function(e){f(n,e,t[e])})}return n}function f(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}t.d(n,"registerCacheChangedHandler",function(){return w}),t.d(n,"cacheTransaction",function(){return E}),t.d(n,"getCache",function(){return K}),t.d(n,"clearAllCaches",function(){return L});var h=500,u=0,s=new Map,v=new Map,g=new Set,o=function(t,e){null===e||Array.isArray(e)&&0===e.length?g.add(t):(Array.isArray(e)?e:[e]).forEach(function(e){var n=v.get(e);void 0===n&&(n=new Set,v.set(e,n)),n.add(t)})},p=function(n,e){null===e||Array.isArray(e)&&0===e.length?g.delete(n):(Array.isArray(e)?e:[e]).forEach(function(e){v.get(e).delete(n)})},w=function(e){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,t=u;u+=1;var r={changedHandler:e,valueTypes:n,isActive:!0,unregister:function(){s.delete(t),p(t,n)},activate:function(){r.isActive=!0,o(t,n)},deactivate:function(){r.isActive=!1,p(t,n)},isRegistered:function(){return s.has(t)}};return s.set(t,r),o(t,n),r},m=function(t){var e,n,r,u=(e=t.valueTypes,n="string"==typeof e?[e]:e,r=new Set,n.forEach(function(e){var n=v.get(e);void 0!==n&&n.forEach(function(e){r.add(e)})}),g.forEach(function(e){r.add(e)}),r),o=[],a=0;if(u.forEach(function(e){var n=s.get(e);try{n.changedHandler(t)}catch(e){o.push(e)}finally{a+=1}}),0<o.length){var l="handleTransactionChangeObject: "+String(o.length)+" of "+String(a)+" handlers threw an error: ";o.forEach(function(e){l+=e.message+", "});var i=new Error(l);throw i.errors=o,i}},b=null,A=0,x=0,E=function(e){if(null===b&&(b={valueTypes:new Set}),x+=1,"function"==typeof e.finally)e.finally(function(){if(0===(x-=1))try{m(b)}finally{b=null,A=0}});else try{e()}finally{if(0===(x-=1))try{m(b)}finally{b=null,A=0}}},S=function(n,e,t,r){var u=b,o=null!==u;null===u&&(u={valueTypes:new Set}),u.valueTypes.has(n)?u[n][t].push(a({},e,{order:A++})):(u.valueTypes.add(n),u[n]=f({},t,[a({},e,{order:A++})]),r.forEach(function(e){u[n][e]=[]})),o||m(u)},O=!0,j=function(e,n){O&&S(e,n,"clearRemoves",["inserts","lruRemoves","deleteRemoves"])},k=function(e,n){O&&S(e,n,"lruRemoves",["clearRemoves","inserts","deleteRemoves"])},M=function(e,n){O&&S(e,n,"deleteRemoves",["clearRemoves","lruRemoves","inserts"])},R=function(u){return function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return new Promise(function(n,t){setTimeout(function(){try{var e=u.apply(void 0,r);n(e)}catch(e){t(e)}},0)})}},C=function(e,n){if(function(e){if(0<g.size)return!0;var n=v.get(e);return void 0!==n&&0<n.size}(e))E(n);else try{O=!1,n()}finally{O=!0}},z=function(c,f,s,e,v){if(!Array.isArray(e))throw new Error("LruCache::setAll: keyValueAlternateKeysArray must be an array");C(c,function(){e.forEach(function(e){var n=e.key,t=e.value,r=e.alternateKeys,u=f.getWithoutLruChange(n),o=Array.isArray(r)?r:[];0===o.length&&"string"==typeof r&&(o=[r]),o.forEach(function(e){if(s.has(e)&&s.get(e)!==n)throw new Error("LruCache::setAll: alternate key '"+e+"' is given for key '"+n+"' and value type '"+c+"' but is already used for key '"+s.get(e)+"'")}),o=new Set(o),void 0===u?u={key:n,value:t,alternateKeys:o}:(u.value=t,u.alternateKeys=new Set(y(u.alternateKeys).concat(y(o))));var a,l,i=f.set(n,u);o.forEach(function(e){s.set(e,n)}),a=c,l=u,O&&S(a,l,"inserts",["clearRemoves","lruRemoves","deleteRemoves"]),null!==i&&(i.value.alternateKeys.forEach(function(e){s.delete(e)}),v&&k(c,i.value))})})};function T(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:h,c=this instanceof T?this:Object.create(T.prototype),r=d(e),f=new Map,u=!1,n=!1;c.dispatchLruRemoves=function(e){u=e},c.dispatchClearRemoves=function(e){n=e},c.setAll=function(e){z(t,r,f,e,u)},c.setAllAsync=R(c.setAll),c.set=function(e){c.setAll([e])},c.setAsync=R(c.set);var s=null,v=new Map,o=function(n,e){var t,r=2<arguments.length&&void 0!==arguments[2]&&arguments[2],u=3<arguments.length&&void 0!==arguments[3]&&arguments[3],o=4<arguments.length&&void 0!==arguments[4]?arguments[4]:null;u||void 0===(t=e(n))&&f.has(n)&&(t=e(f.get(n)));var a=s;if(null!==o&&(a=o),void 0!==t)return t.value;if(r&&null!==a){if(v.has(n))return v.get(n);var l=a(n);if(!l)return t;if("function"!=typeof l.then)return c.set(l),l.value;var i=l.then(function(e){return e?(v.has(n)&&c.set(e),e.value):e}).finally(function(){v.delete(n)});return v.set(n,i),i}if(u)throw new Error("called get with notFromCache, but no entry getter was set");return t};return c.setEntryGetter=function(e){s=e},c.get=function(e){var n=1<arguments.length&&void 0!==arguments[1]&&arguments[1],t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;return o(e,r.get,!0,n,t)},c.getWithoutLruChange=function(e){var n=1<arguments.length&&void 0!==arguments[1]&&arguments[1],t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;return o(e,r.getWithoutLruChange,!0,n,t)},c.has=function(e){return!!r.has(e)||f.has(e)},c.delete=function(e){var n=r.getWithoutLruChange(e);return void 0===n?(C(t,function(){M(t,{key:e})}),!1):(r.delete(n.key),n.alternateKeys.forEach(function(e){f.delete(e)}),C(t,function(){M(t,{key:e})}),!0)},c.forEach=r.forEach,c.getEntries=function(){return r.map(function(e){return e})},c.clear=function(){var e=r.clear();f.clear(),n&&C(t,function(){e.forEach(function(e){j(t,e.value)})})},c.getSize=r.getSize,c.getValueType=function(){return t},c.getMaxSize=r.getMaxSize,c.setMaxSize=function(e){var n=r.setMaxSize(e);C(t,function(){n.forEach(function(e){e.value.alternateKeys.forEach(function(e){f.delete(e)}),u&&k(t,e.value)})})},c}var P=new Map,K=function(e){var n=P.get(e);return void 0===n&&(n=T(e),P.set(e,n)),n},L=function(){E(function(){P.forEach(function(e){e.clear()})})}}]);
module.exports=function(t){var r={};function u(e){if(r[e])return r[e].exports;var n=r[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,u),n.l=!0,n.exports}return u.m=t,u.c=r,u.d=function(e,n,t){u.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:t})},u.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.t=function(n,e){if(1&e&&(n=u(n)),8&e)return n;if(4&e&&"object"==typeof n&&n&&n.__esModule)return n;var t=Object.create(null);if(u.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:n}),2&e&&"string"!=typeof n)for(var r in n)u.d(t,r,function(e){return n[e]}.bind(null,r));return t},u.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(n,"a",n),n},u.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},u.p="",u(u.s=0)}([function(e,n,t){"use strict";t.r(n);var l=function(e,n){null===n.newest?(n.newest=e,n.oldest=e):((n.newest.next=e).prev=n.newest,n.newest=e)},i=function(e,n){e!==n.newest&&(null===(n.newest.next=e).prev?(e.prev=n.newest,e.next.prev=null,n.oldest=e.next):(e.prev.next=e.next,e.next.prev=e.prev,e.prev=n.newest),e.next=null,n.newest=e)},r=function(e,n,t){null===e.next?n.newest=e.prev:e.next.prev=e.prev,null===e.prev?n.oldest=e.next:e.prev.next=e.next,t.delete(e.key)},c=function(e,n,t){var r,u,o,a=[];if(null===e)return a;for(;t.size>e;)a.push((u=t,void 0,o=(r=n).oldest,u.delete(r.oldest.key),r.oldest=r.oldest.next,r.oldest.prev=null,{key:o.key,value:o.value}));return a};function d(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,n=this instanceof d?this:Object.create(d.prototype),u=e;0===u&&(u=null);var o=new Map,a={newest:null,oldest:null};return n.setMaxSize=function(e){return(u=e)<1&&(u=null),c(u,a,o)},n.getMaxSize=function(){return u},n.getSize=function(){return o.size},n.set=function(e,n){var t=o.get(e);if(void 0!==t)return t.value=n,i(t,a),null;t={key:e,value:n,next:null,prev:null},o.set(e,t),l(t,a);var r=c(u,a,o);return 1===r.length?r[0]:null},n.get=function(e){var n=o.get(e);return void 0===n?n:(i(n,a),n.value)},n.getWithoutLruChange=function(e){var n=o.get(e);return void 0===n?n:n.value},n.has=function(e){return o.has(e)},n.delete=function(e){var n=o.get(e);return void 0!==n&&(r(n,a,o),!0)},n.forEach=function(e){for(var n=a.oldest;null!==n;)e(n.value,n.key),n=n.next},n.map=function(e){for(var n=a.oldest,t=[];null!==n;)t.push(e(n.value,n.key)),n=n.next;return t},n.clear=function(){var e=n.map(function(e,n){return{key:n,value:e}});return o.clear(),a.newest=null,a.oldest=null,e},n}function h(e){return function(e){if(Array.isArray(e)){for(var n=0,t=new Array(e.length);n<e.length;n++)t[n]=e[n];return t}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function a(n){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{},r=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.forEach(function(e){f(n,e,t[e])})}return n}function f(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}t.d(n,"registerCacheChangedHandler",function(){return w}),t.d(n,"cacheTransaction",function(){return E}),t.d(n,"getCache",function(){return K}),t.d(n,"clearAllCaches",function(){return L});var y=500,u=0,s=new Map,v=new Map,g=new Set,o=function(t,e){null===e||Array.isArray(e)&&0===e.length?g.add(t):(Array.isArray(e)?e:[e]).forEach(function(e){var n=v.get(e);void 0===n&&(n=new Set,v.set(e,n)),n.add(t)})},p=function(n,e){null===e||Array.isArray(e)&&0===e.length?g.delete(n):(Array.isArray(e)?e:[e]).forEach(function(e){v.get(e).delete(n)})},w=function(e){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,t=u;u+=1;var r={changedHandler:e,valueTypes:n,isActive:!0,unregister:function(){s.delete(t),p(t,n)},activate:function(){r.isActive=!0,o(t,n)},deactivate:function(){r.isActive=!1,p(t,n)},isRegistered:function(){return s.has(t)}};return s.set(t,r),o(t,n),r},m=function(t){var e,n,r,u=(e=t.valueTypes,n="string"==typeof e?[e]:e,r=new Set,n.forEach(function(e){var n=v.get(e);void 0!==n&&n.forEach(function(e){r.add(e)})}),g.forEach(function(e){r.add(e)}),r),o=[],a=0;if(u.forEach(function(e){var n=s.get(e);try{n.changedHandler(t)}catch(e){o.push(e)}finally{a+=1}}),0<o.length){var l="handleTransactionChangeObject: "+String(o.length)+" of "+String(a)+" handlers threw an error: ";o.forEach(function(e){l+=e.message+", "});var i=new Error(l);throw i.errors=o,i}},b=null,A=0,x=0,E=function(e){if(null===b&&(b={valueTypes:new Set}),x+=1,"function"==typeof e.finally)e.finally(function(){if(0===(x-=1)){var e=b;b=null,A=0,m(e)}});else try{e()}finally{if(0===(x-=1)){var n=b;b=null,A=0,m(n)}}},S=function(n,e,t,r){var u=b,o=null!==u;null===u&&(u={valueTypes:new Set}),u.valueTypes.has(n)?u[n][t].push(a({},e,{order:A++})):(u.valueTypes.add(n),u[n]=f({},t,[a({},e,{order:A++})]),r.forEach(function(e){u[n][e]=[]})),o||m(u)},O=!0,j=function(e,n){O&&S(e,n,"clearRemoves",["inserts","lruRemoves","deleteRemoves"])},k=function(e,n){O&&S(e,n,"lruRemoves",["clearRemoves","inserts","deleteRemoves"])},M=function(e,n){O&&S(e,n,"deleteRemoves",["clearRemoves","lruRemoves","inserts"])},R=function(u){return function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return new Promise(function(n,t){setTimeout(function(){try{var e=u.apply(void 0,r);n(e)}catch(e){t(e)}},0)})}},C=function(e,n){if(function(e){if(0<g.size)return!0;var n=v.get(e);return void 0!==n&&0<n.size}(e))E(n);else try{O=!1,n()}finally{O=!0}},z=function(c,f,s,e,v){if(!Array.isArray(e))throw new Error("LruCache::setAll: keyValueAlternateKeysArray must be an array");C(c,function(){e.forEach(function(e){var n=e.key,t=e.value,r=e.alternateKeys,u=f.getWithoutLruChange(n),o=Array.isArray(r)?r:[];0===o.length&&"string"==typeof r&&(o=[r]),o.forEach(function(e){if(s.has(e)&&s.get(e)!==n)throw new Error("LruCache::setAll: alternate key '"+e+"' is given for key '"+n+"' and value type '"+c+"' but is already used for key '"+s.get(e)+"'")}),o=new Set(o),void 0===u?u={key:n,value:t,alternateKeys:o}:(u.value=t,u.alternateKeys=new Set(h(u.alternateKeys).concat(h(o))));var a,l,i=f.set(n,u);o.forEach(function(e){s.set(e,n)}),a=c,l=u,O&&S(a,l,"inserts",["clearRemoves","lruRemoves","deleteRemoves"]),null!==i&&(i.value.alternateKeys.forEach(function(e){s.delete(e)}),v&&k(c,i.value))})})};function T(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:y,c=this instanceof T?this:Object.create(T.prototype),r=d(e),f=new Map,u=!1,n=!1;c.dispatchLruRemoves=function(e){u=e},c.dispatchClearRemoves=function(e){n=e},c.setAll=function(e){z(t,r,f,e,u)},c.setAllAsync=R(c.setAll),c.set=function(e){c.setAll([e])},c.setAsync=R(c.set);var s=null,v=new Map,o=function(n,e){var t,r=2<arguments.length&&void 0!==arguments[2]&&arguments[2],u=3<arguments.length&&void 0!==arguments[3]&&arguments[3],o=4<arguments.length&&void 0!==arguments[4]?arguments[4]:null;u||void 0===(t=e(n))&&f.has(n)&&(t=e(f.get(n)));var a=s;if(null!==o&&(a=o),void 0!==t)return t.value;if(r&&null!==a){if(v.has(n))return v.get(n);var l=a(n);if(!l)return t;if("function"!=typeof l.then)return c.set(l),l.value;var i=l.then(function(e){return e?(v.has(n)&&c.set(e),e.value):e}).finally(function(){v.delete(n)});return v.set(n,i),i}if(u)throw new Error("called get with notFromCache, but no entry getter was set");return t};return c.setEntryGetter=function(e){s=e},c.get=function(e){var n=1<arguments.length&&void 0!==arguments[1]&&arguments[1],t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;return o(e,r.get,!0,n,t)},c.getWithoutLruChange=function(e){var n=1<arguments.length&&void 0!==arguments[1]&&arguments[1],t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;return o(e,r.getWithoutLruChange,!0,n,t)},c.has=function(e){return!!r.has(e)||f.has(e)},c.delete=function(e){var n=r.getWithoutLruChange(e);return void 0===n?(C(t,function(){M(t,{key:e})}),!1):(r.delete(n.key),n.alternateKeys.forEach(function(e){f.delete(e)}),C(t,function(){M(t,{key:e})}),!0)},c.forEach=r.forEach,c.getEntries=function(){return r.map(function(e){return e})},c.clear=function(){var e=r.clear();f.clear(),n&&C(t,function(){e.forEach(function(e){j(t,e.value)})})},c.getSize=r.getSize,c.getValueType=function(){return t},c.getMaxSize=r.getMaxSize,c.setMaxSize=function(e){var n=r.setMaxSize(e);C(t,function(){n.forEach(function(e){e.value.alternateKeys.forEach(function(e){f.delete(e)}),u&&k(t,e.value)})})},c}var P=new Map,K=function(e){var n=P.get(e);return void 0===n&&(n=T(e),P.set(e,n)),n},L=function(){E(function(){P.forEach(function(e){e.clear()})})}}]);
{
"name": "@swarmy/lru-cache",
"version": "3.2.0",
"version": "3.2.1",
"description": "LRU cache with event registry to handle cache changes",

@@ -5,0 +5,0 @@ "author": "Gerd Neudert",

@@ -76,3 +76,3 @@ # lru-cache

* [Detailed Usage](#caching-detail)
* [JSDoc](https://rawcdn.githack.com/gneu77/lru-cache/1b52feca07fbe0a44b8cdc991de3e2c7563e55bc/docs/index.html)
* [JSDoc](https://rawcdn.githack.com/gneu77/lru-cache/9b6dacbb3744ad01ecb83c0e7479914e327722b8/docs/index.html)

@@ -90,8 +90,8 @@ ### Cache Events

* [Detailed Usage](#cache-events-detail)
* [JSDoc](https://rawcdn.githack.com/gneu77/lru-cache/1b52feca07fbe0a44b8cdc991de3e2c7563e55bc/docs/index.html)
* [JSDoc](https://rawcdn.githack.com/gneu77/lru-cache/9b6dacbb3744ad01ecb83c0e7479914e327722b8/docs/index.html)
## Quality <a name="section-quality"></a>
* [Test results](https://rawcdn.githack.com/gneu77/lru-cache/1b52feca07fbe0a44b8cdc991de3e2c7563e55bc/test-report.html)
* [Test coverage](https://rawcdn.githack.com/gneu77/lru-cache/1b52feca07fbe0a44b8cdc991de3e2c7563e55bc/coverage/index.html)
* [Performance tests](https://rawcdn.githack.com/gneu77/lru-cache/1b52feca07fbe0a44b8cdc991de3e2c7563e55bc/performance-report.html)
* [Test results](https://rawcdn.githack.com/gneu77/lru-cache/9b6dacbb3744ad01ecb83c0e7479914e327722b8/test-report.html)
* [Test coverage](https://rawcdn.githack.com/gneu77/lru-cache/9b6dacbb3744ad01ecb83c0e7479914e327722b8/coverage/index.html)
* [Performance tests](https://rawcdn.githack.com/gneu77/lru-cache/9b6dacbb3744ad01ecb83c0e7479914e327722b8/performance-report.html)

@@ -180,6 +180,6 @@ ## Develop <a name="section-develop"></a>

* Also compared to LRU maps that do not support alternate keys, there is a performance impact on get in case of cache misses.
* See [Performance tests](https://rawcdn.githack.com/gneu77/lru-cache/1b52feca07fbe0a44b8cdc991de3e2c7563e55bc/performance-report.html)
* See [Performance tests](https://rawcdn.githack.com/gneu77/lru-cache/9b6dacbb3744ad01ecb83c0e7479914e327722b8/performance-report.html)
* However, get, set and delete are still O(1). (setMaxSize has O(size-newMaxSize), if size>newMaxSize)
* Compared to a LRU cache without cache events, there is additional performance impact on get, set and delete.
* Again see [Performance tests](https://rawcdn.githack.com/gneu77/lru-cache/1b52feca07fbe0a44b8cdc991de3e2c7563e55bc/performance-report.html)
* Again see [Performance tests](https://rawcdn.githack.com/gneu77/lru-cache/9b6dacbb3744ad01ecb83c0e7479914e327722b8/performance-report.html)
* However, if you are caching for performance, then because the fetching of values is significantly more time consuming. So whether you save 400ms or only 399ms hardly makes a difference here.

@@ -186,0 +186,0 @@ * If you are not caching for performance reasons, but to have the change events, well than again it's just the price to pay for the event handling.

@@ -170,9 +170,6 @@ import {LruMap} from "./LruMap";

if (runningTransactions === 0) {
try {
handleTransactionChangeObject(transactionChangeObject);
}
finally {
transactionChangeObject = null;
changeOrder = 0;
}
const changeObject = transactionChangeObject;
transactionChangeObject = null;
changeOrder = 0;
handleTransactionChangeObject(changeObject);
}

@@ -188,9 +185,6 @@ });

if (runningTransactions === 0) {
try {
handleTransactionChangeObject(transactionChangeObject);
}
finally {
transactionChangeObject = null;
changeOrder = 0;
}
const changeObject = transactionChangeObject;
transactionChangeObject = null;
changeOrder = 0;
handleTransactionChangeObject(changeObject);
}

@@ -197,0 +191,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