{"_id":"safe-memory-cache","_rev":"28-9fa1bdb349eec10c6259a6502eb9f21c","name":"safe-memory-cache","dist-tags":{"latest":"3.0.0"},"versions":{"1.0.0-rc.1":{"name":"safe-memory-cache","version":"1.0.0-rc.1","keywords":["memory","cache","secure","safe","ram","simple","storage"],"author":{"name":"Zbyszek Tenerowicz","email":"naugtur@gmail.com"},"license":"MIT","_id":"safe-memory-cache@1.0.0-rc.1","maintainers":[{"name":"naugtur","email":"naugtur@gmail.com"}],"homepage":"https://github.com/naugtur/safe-memory-cache","bugs":{"url":"https://github.com/naugtur/safe-memory-cache/issues"},"dist":{"shasum":"1ec3ca44e1fcdce64cd1a523a078a37341612e6f","tarball":"https://registry.npmjs.org/safe-memory-cache/-/safe-memory-cache-1.0.0-rc.1.tgz","integrity":"sha512-dTFM2w6dNgmj7rIRmTklEvXpNE7jczKyxcN+/Tk9ShwQPgmLg8h7mRWbWV8Lp4lEiojqtu/pdzDNQaMJ81jQ8g==","signatures":[{"sig":"MEUCIQD5LDz1upwdq/RzVgjPCnZxYBPJpcvo2HdNiQyocYWDZAIgPl/4gHERRzWFcaFWSJwZxPwR/QrJa7wfxOSxyJFwMhw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"1ec3ca44e1fcdce64cd1a523a078a37341612e6f","gitHead":"20f69a6f1ae2b89b565cb917118ceb92f0fa7b89","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"naugtur","email":"naugtur@gmail.com"},"repository":{"url":"https://github.com/naugtur/safe-memory-cache.git","type":"git"},"_npmVersion":"2.14.7","description":"Secure and size-limited in-memory cache for Node.js and browsers","directories":{},"_nodeVersion":"4.2.2"},"1.1.0-0":{"name":"safe-memory-cache","version":"1.1.0-0","keywords":["memory","cache","secure","safe","ram","simple","storage"],"author":{"name":"Zbyszek Tenerowicz","email":"naugtur@gmail.com"},"license":"MIT","_id":"safe-memory-cache@1.1.0-0","maintainers":[{"name":"naugtur","email":"naugtur@gmail.com"}],"homepage":"https://github.com/naugtur/safe-memory-cache","bugs":{"url":"https://github.com/naugtur/safe-memory-cache/issues"},"dist":{"shasum":"3d588a554715b7b927688478bd9b921ebf530cad","tarball":"https://registry.npmjs.org/safe-memory-cache/-/safe-memory-cache-1.1.0-0.tgz","integrity":"sha512-NW6VPOa4xyrfX1Bcvp3+kdukPuWZ23FTcGiqfxfeK9eg7gv6nC3UXz3qaO9mIyM+rucfZHVZvQx8ETH4a8Am/w==","signatures":[{"sig":"MEUCIQCqek+kycrstsjNI87DWenSTyTAAXu5sCQeWktijkoQnwIgfybv2VSa1afnNJEcn3jgHf2UdsjeQ/OUBdUtLzyeQqw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"3d588a554715b7b927688478bd9b921ebf530cad","gitHead":"594523f4deb90a8b8c879871bddb5ceca0d7ff98","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"naugtur","email":"naugtur@gmail.com"},"repository":{"url":"git+https://github.com/naugtur/safe-memory-cache.git","type":"git"},"_npmVersion":"3.10.10","description":"Secure and size-limited in-memory cache for Node.js and browsers","directories":{},"_nodeVersion":"6.10.1","_npmOperationalInternal":{"tmp":"tmp/safe-memory-cache-1.1.0-0.tgz_1498132161872_0.51856730110012","host":"s3://npm-registry-packages"}},"1.1.0":{"name":"safe-memory-cache","version":"1.1.0","keywords":["memory","cache","secure","safe","ram","simple","storage"],"author":{"name":"Zbyszek Tenerowicz","email":"naugtur@gmail.com"},"license":"MIT","_id":"safe-memory-cache@1.1.0","maintainers":[{"name":"naugtur","email":"naugtur@gmail.com"}],"homepage":"https://github.com/naugtur/safe-memory-cache","bugs":{"url":"https://github.com/naugtur/safe-memory-cache/issues"},"dist":{"shasum":"666b2a319b77a7ed2b5e97b9d46b59ecad68981f","tarball":"https://registry.npmjs.org/safe-memory-cache/-/safe-memory-cache-1.1.0.tgz","integrity":"sha512-Bi+wkqVwYA8g8Q//NPGrydt3uKfgqBO6SOGNB4YrgYYDCwVudYA+18ex0JKF9bDCmK/xG7ZPboSCPLTLP91bWA==","signatures":[{"sig":"MEQCIC2TSP8yFdk33y1sKAkwVLqwahLblR1QpCr6wvrqkP2vAiBn3oZBVihfu+CWghADHJsCZPBs6wRDmknX2X1GfHppBg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"666b2a319b77a7ed2b5e97b9d46b59ecad68981f","gitHead":"6a55c3c2cd7a5a2def790f2a36b2d672b7fb5565","scripts":{"test":"node test.js"},"_npmUser":{"name":"naugtur","email":"naugtur@gmail.com"},"repository":{"url":"git+https://github.com/naugtur/safe-memory-cache.git","type":"git"},"_npmVersion":"3.10.10","description":"Secure and size-limited in-memory cache for Node.js and browsers","directories":{},"_nodeVersion":"6.10.1","_npmOperationalInternal":{"tmp":"tmp/safe-memory-cache-1.1.0.tgz_1498134508782_0.32491706777364016","host":"s3://npm-registry-packages"}},"1.2.0":{"name":"safe-memory-cache","version":"1.2.0","keywords":["memory","cache","secure","safe","ram","simple","storage"],"author":{"name":"Zbyszek Tenerowicz","email":"naugtur@gmail.com"},"license":"MIT","_id":"safe-memory-cache@1.2.0","maintainers":[{"name":"naugtur","email":"naugtur@gmail.com"}],"homepage":"https://github.com/naugtur/safe-memory-cache","bugs":{"url":"https://github.com/naugtur/safe-memory-cache/issues"},"dist":{"shasum":"5548bbd7f35731c40101ea4a52c63226bdd81d36","tarball":"https://registry.npmjs.org/safe-memory-cache/-/safe-memory-cache-1.2.0.tgz","integrity":"sha512-TE4yJ0Y5hfwOobAxOGZK9gsK1N2yv5FlrG+LKtKAsTvhEym2UoszKsfoc8Y+SXvZQOBnJkVXWUL2FDyQEhqbZg==","signatures":[{"sig":"MEUCIFh839REZhK4ovr04apn//mZiyDTR3sNjJxiId9utot6AiEAnmUTwJ2AkYBd+Pzk4+AR4WeGBbMXvlPrGEaMDlP3VOU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"5548bbd7f35731c40101ea4a52c63226bdd81d36","gitHead":"273ea0c78f78b097cc86f746f65c052018a94941","scripts":{"test":"node test.js"},"_npmUser":{"name":"naugtur","email":"naugtur@gmail.com"},"deprecated":"broken map implementation, use v1.2.1","repository":{"url":"git+https://github.com/naugtur/safe-memory-cache.git","type":"git"},"_npmVersion":"3.10.10","description":"Secure and size-limited in-memory cache for Node.js and browsers","directories":{},"_nodeVersion":"6.10.1","_npmOperationalInternal":{"tmp":"tmp/safe-memory-cache-1.2.0.tgz_1498135084322_0.23791491007432342","host":"s3://npm-registry-packages"}},"1.2.1":{"name":"safe-memory-cache","version":"1.2.1","keywords":["memory","cache","secure","safe","ram","simple","storage"],"author":{"name":"Zbyszek Tenerowicz","email":"naugtur@gmail.com"},"license":"MIT","_id":"safe-memory-cache@1.2.1","maintainers":[{"name":"naugtur","email":"naugtur@gmail.com"}],"homepage":"https://github.com/naugtur/safe-memory-cache","bugs":{"url":"https://github.com/naugtur/safe-memory-cache/issues"},"dist":{"shasum":"7c7d8ccf5b30d4c3e7078b633008db58b667dc1f","tarball":"https://registry.npmjs.org/safe-memory-cache/-/safe-memory-cache-1.2.1.tgz","integrity":"sha512-aSspvgXcDV/9MBTd8sAgQ+josoKaVmisUA6KqqNc5J932zVTnHyKtP5Y8HGdV9I47bkSsq0Wio5fv5rwkVii7w==","signatures":[{"sig":"MEUCIQCEh9hquUks/uhKuehLWrNC3uChm5ylE9UBsp/rmAfIPQIgAxQkc+tNhDfJvC7dLY9ow70FsFdDauuRP1YramaxR6Y=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"7c7d8ccf5b30d4c3e7078b633008db58b667dc1f","gitHead":"f84bc31fc905f58efbc9686f54b678acf54d5e63","scripts":{"test":"node test.js"},"_npmUser":{"name":"naugtur","email":"naugtur@gmail.com"},"deprecated":"v1.2.3 fixes an issue in map implementation","repository":{"url":"git+https://github.com/naugtur/safe-memory-cache.git","type":"git"},"_npmVersion":"2.15.11","description":"Secure and size-limited in-memory cache for Node.js and browsers","directories":{},"_nodeVersion":"4.8.1","_npmOperationalInternal":{"tmp":"tmp/safe-memory-cache-1.2.1.tgz_1498473996038_0.9361372671555728","host":"s3://npm-registry-packages"}},"1.2.3":{"name":"safe-memory-cache","version":"1.2.3","keywords":["memory","cache","secure","safe","ram","simple","storage"],"author":{"name":"Zbyszek Tenerowicz","email":"naugtur@gmail.com"},"license":"MIT","_id":"safe-memory-cache@1.2.3","maintainers":[{"name":"naugtur","email":"naugtur@gmail.com"}],"homepage":"https://github.com/naugtur/safe-memory-cache","bugs":{"url":"https://github.com/naugtur/safe-memory-cache/issues"},"dist":{"shasum":"e073e9f8b67bfdc6b2f70b95bdd673a16382654c","tarball":"https://registry.npmjs.org/safe-memory-cache/-/safe-memory-cache-1.2.3.tgz","integrity":"sha512-bh5sPZ31r1x1lDYDZSqIbxg5zDpH2M64EfT2Jvfy3sVCxILQeW0CALRJ03bWW5Cfmr119VSRC4j3MOw0n3h+hg==","signatures":[{"sig":"MEUCIHrl0qRb/utUkdR+TtE08C8q/O0voHUAUpBDg685MqeEAiEA7ouuZssjLgFrt1Ixbfm7vOWfZr43rCI53Yse7iqN1eA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"e073e9f8b67bfdc6b2f70b95bdd673a16382654c","gitHead":"1ddb817a26d41f97dd375f87c6155b31e9d3f697","scripts":{"test":"node test.js"},"_npmUser":{"name":"naugtur","email":"naugtur@gmail.com"},"repository":{"url":"git+https://github.com/naugtur/safe-memory-cache.git","type":"git"},"_npmVersion":"3.10.10","description":"Secure and size-limited in-memory cache for Node.js and browsers","directories":{},"_nodeVersion":"6.10.1","_npmOperationalInternal":{"tmp":"tmp/safe-memory-cache-1.2.3.tgz_1498737000816_0.594372650841251","host":"s3://npm-registry-packages"}},"1.5.0":{"name":"safe-memory-cache","version":"1.5.0","keywords":["memory","cache","secure","safe","ram","simple","storage"],"author":{"name":"Zbyszek Tenerowicz","email":"naugtur@gmail.com"},"license":"MIT","_id":"safe-memory-cache@1.5.0","maintainers":[{"name":"naugtur","email":"naugtur@gmail.com"}],"homepage":"https://github.com/naugtur/safe-memory-cache","bugs":{"url":"https://github.com/naugtur/safe-memory-cache/issues"},"dist":{"shasum":"2ec50138924ea82807f57a7742571496bc2e87a1","tarball":"https://registry.npmjs.org/safe-memory-cache/-/safe-memory-cache-1.5.0.tgz","integrity":"sha512-TOHL8AWcdBZi59aY73u1K+3Nr6xYqP65pCp/Bvt0w+1X/xQC/FliT4JH+aVzkpSBYWW4MM04ZtPt/HzTrp9Z2g==","signatures":[{"sig":"MEYCIQCpzJcdn/Rx3JhuT5JnIwUFqe1ZC2jRMc9aODMiiB6CGQIhAKOU3m/13jF94SyaShuOflXz02uxFRyVMQg1pYpqkvrl","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"2ec50138924ea82807f57a7742571496bc2e87a1","gitHead":"a3162c43719cf59bd1d5d31f68c4164b79e4123a","scripts":{"test":"node test.js"},"_npmUser":{"name":"naugtur","email":"naugtur@gmail.com"},"repository":{"url":"git+https://github.com/naugtur/safe-memory-cache.git","type":"git"},"_npmVersion":"3.10.10","description":"Secure and size-limited in-memory cache for Node.js and browsers","directories":{},"_nodeVersion":"6.10.1","_npmOperationalInternal":{"tmp":"tmp/safe-memory-cache-1.5.0.tgz_1498739013098_0.027399639831855893","host":"s3://npm-registry-packages"}},"1.5.1":{"name":"safe-memory-cache","version":"1.5.1","keywords":["memory","cache","secure","safe","ram","simple","storage"],"author":{"name":"Zbyszek Tenerowicz","email":"naugtur@gmail.com"},"license":"MIT","_id":"safe-memory-cache@1.5.1","maintainers":[{"name":"naugtur","email":"naugtur@gmail.com"}],"homepage":"https://github.com/naugtur/safe-memory-cache","bugs":{"url":"https://github.com/naugtur/safe-memory-cache/issues"},"dist":{"shasum":"c3e01e148e214e1b6197d58e3ebf278af0e4c925","tarball":"https://registry.npmjs.org/safe-memory-cache/-/safe-memory-cache-1.5.1.tgz","integrity":"sha512-yGORU3WUBBCCvyhKYVfJo3qBX4rTYkEEHoIG7uFbLsi5vGLjrIt5tAKOb6cRA94qJgw7MPnEpNp6yXT5fnzgWg==","signatures":[{"sig":"MEQCIGC4rQjbfjHH6NtI80JqpuYPzLcB/335Arav9794Vf34AiAW5/EPMVaSU5e0b40kELzIz0NkNWdoB4QU8wQ9qcCpAQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"c3e01e148e214e1b6197d58e3ebf278af0e4c925","gitHead":"83dc2cc1d2b53f295eb222ff26144652a6700437","scripts":{"test":"node test.js"},"_npmUser":{"name":"naugtur","email":"naugtur@gmail.com"},"repository":{"url":"git+https://github.com/naugtur/safe-memory-cache.git","type":"git"},"_npmVersion":"3.10.10","description":"Secure and size-limited in-memory cache for Node.js and browsers","directories":{},"_nodeVersion":"6.10.1","_npmOperationalInternal":{"tmp":"tmp/safe-memory-cache-1.5.1.tgz_1498739595592_0.42384697613306344","host":"s3://npm-registry-packages"}},"2.0.0":{"name":"safe-memory-cache","version":"2.0.0","keywords":["memory","cache","secure","safe","ram","simple","storage"],"author":{"name":"Zbyszek Tenerowicz","email":"naugtur@gmail.com"},"license":"MIT","_id":"safe-memory-cache@2.0.0","maintainers":[{"name":"naugtur","email":"naugtur@gmail.com"}],"homepage":"https://github.com/naugtur/safe-memory-cache","bugs":{"url":"https://github.com/naugtur/safe-memory-cache/issues"},"dist":{"shasum":"66eb00e515a0838972b6d85b38e2fc28afe63379","tarball":"https://registry.npmjs.org/safe-memory-cache/-/safe-memory-cache-2.0.0.tgz","fileCount":6,"integrity":"sha512-49YT3x2WpAQ5gYhYpHaZdOLJwqgePkbRpPZXHHzLtRObVJXkgyoAg74jvJA6r3KCeQYw8x09o9b5bQK3LPC1BA==","signatures":[{"sig":"MEUCIGUd82njzVTJXb+I61b0saiFiCEbhz0kPjvZ8Qo+6p7jAiEAt/8W8xRhCddHuJlBrwyU65GmeGn6jXm0xuKzldzGpU4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11821,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdycV6CRA9TVsSAnZWagAADhIP+gNZbhWyZES+nGW5NpkM\nNnwscND69gHaF8k/p6UaBSZqGIs2KExsEQo2s0MWvA6mtpeePG+aKL8MgQrc\nz0LrLcytNLddUe62jG36/EXxdi3uLhVl/m+c3CLNc/qj5tRwcVrVB56sJ6hc\nKgwGLFI82BiLR6EUQMYQr5khMmqal2e6dgVdN7yJelLQpj7bcyGgS64vwDU5\nC43VqwzDD7BxZARN3sBbgiH33Px6Lv115NpSh8hjLABNlwTm9T5rHw8I3miC\nDZ9jgKIN1sp85ZSmgEhuGEQFRNNfE6Uxd6aas2tIhlSbOcr1V+UPiZ95FgtC\nQOkY8rOnxkesnMGTxgGQZsxbKc2AhTdc2Y8tXsYfkrsEvz5YNxc89aMujgEV\nbU8lZctresp4n7+c4QrwcptCbVt3RtUgEoU4lpB4GUcnP/e61UCN9vCknl20\ncGjmHEwa/H67McUvMGTNOMmNcH1dNtfcCnRhoEh66rRdfav+IT31DNyujDH0\nfVnhWuHLu7cWUSevZQrV+Ym8BUP33bBu8P0t6gSK/DzeHmD/WW08g0SkN45L\n3Nbt62qTOnLBMOAAiZ75kIeTwsSXnzKDU/37r96sr3AH6AK7lwfSv6CpOFEa\nS26avwAtyoQmWFvtFVt7RQU7g/71FX4DEPwaEnnlV7kaNASCzblQKHHpWWt3\nxEmM\r\n=nLWq\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","gitHead":"0f80c1882886370d68fb6470f781002d48c0cda3","scripts":{"test":"node test.js"},"_npmUser":{"name":"naugtur","email":"naugtur@gmail.com"},"repository":{"url":"git+https://github.com/naugtur/safe-memory-cache.git","type":"git"},"_npmVersion":"6.11.3","description":"Secure and size-limited in-memory cache for Node.js and browsers","directories":{},"_nodeVersion":"12.10.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/safe-memory-cache_2.0.0_1573504378551_0.8812294960426095","host":"s3://npm-registry-packages"}},"3.0.0":{"name":"safe-memory-cache","version":"3.0.0","description":"Secure and size-limited in-memory cache for Node.js and browsers","main":"index.js","scripts":{"test":"node --expose-gc --test test.js"},"repository":{"type":"git","url":"git+https://github.com/naugtur/safe-memory-cache.git"},"keywords":["memory","cache","secure","safe","ram","simple","storage"],"author":{"name":"naugtur","email":"naugtur@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/naugtur/safe-memory-cache/issues"},"homepage":"https://github.com/naugtur/safe-memory-cache","_id":"safe-memory-cache@3.0.0","gitHead":"7f2672726533b3ffacee805098350d69ee52072c","_nodeVersion":"22.14.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-+rkfJ7p/yPAtQCLR9e/te5ojv5C9d/xo40S42d8IHnJKA5wsD/1k0CbLnuEL1C2dxbzUFvA/FikLSD0IaLxa7A==","shasum":"71cadc2428cbefc041a532b2b634ac456b7eb321","tarball":"https://registry.npmjs.org/safe-memory-cache/-/safe-memory-cache-3.0.0.tgz","fileCount":5,"unpackedSize":11112,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDB3A/hv8K5S5aIFxdpZ97mnytTmFSlbEKSlSJkC5E57QIgfOjtNoWlw7s+lNT6EsfLMo3esKsltk2k3kQrGaC1/jg="}]},"_npmUser":{"name":"naugtur","email":"naugtur@gmail.com"},"directories":{},"maintainers":[{"name":"naugtur","email":"naugtur@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/safe-memory-cache_3.0.0_1739564384112_0.4492831442590628"},"_hasShrinkwrap":false}},"time":{"created":"2016-01-22T01:17:25.133Z","modified":"2025-02-14T20:19:44.482Z","1.0.0-rc.1":"2016-01-22T01:17:25.133Z","1.1.0-0":"2017-06-22T11:49:23.178Z","1.1.0":"2017-06-22T12:28:29.608Z","1.2.0":"2017-06-22T12:38:05.330Z","1.2.1":"2017-06-26T10:46:37.002Z","1.3.0":"2017-06-26T11:00:53.351Z","1.4.0":"2017-06-26T11:05:17.009Z","1.2.2":"2017-06-29T11:40:21.096Z","1.2.3":"2017-06-29T11:50:01.758Z","1.5.0":"2017-06-29T12:23:34.029Z","1.5.1":"2017-06-29T12:33:16.748Z","2.0.0":"2019-11-11T20:32:58.699Z","3.0.0":"2025-02-14T20:19:44.304Z"},"bugs":{"url":"https://github.com/naugtur/safe-memory-cache/issues"},"author":{"name":"naugtur","email":"naugtur@gmail.com"},"license":"MIT","homepage":"https://github.com/naugtur/safe-memory-cache","keywords":["memory","cache","secure","safe","ram","simple","storage"],"repository":{"type":"git","url":"git+https://github.com/naugtur/safe-memory-cache.git"},"description":"Secure and size-limited in-memory cache for Node.js and browsers","maintainers":[{"name":"naugtur","email":"naugtur@gmail.com"}],"readme":"# safe-memory-cache\nSecure and size-limited in-memory cache for Node.js and browsers.\n\nUpdated with defensive coding (for prototype poisoning immunity)\n\n## Why another cache package?\n\n- Is lightweight and has trivial API\n- Can't be broken by a malicious key (`__proto__`) or a prototype poisoning of intrinsics\n- Limits the number of items without the use of `delete` (and no memory leaks caused by `delete`), plays well with garbage collector. But also **doesn't drop the whole cache when full, frees up gradually**\n- Doesn't waste your eventloop ticks with timeouts set to remove single items from cache, but still deletes oldest items first\n\n## Usage\n\n```\nvar {safeMemoryCache} = require('safe-memory-cache')\nvar cache = safeMemoryCache(options)\n\ncache.set(\"key1\",\"value1\")\ncache.get(\"key1\") === \"value1\"\n\ncache.clear()\ncache.get(\"key1\") === undefined\n\n```\n\n### options:\n\nname | type | required | description\n --- | --- | --- | ---\n limit | number | Y | Maximum number of items to store in cache. When cache length is close to the limit, oldest items are removed to make more room.\n maxTTL | number | N | Time in miliseconds within which an element should no longer be in cache if it was not accessed. Actual time is approximate and will be less or equal `maxTTL`\n buckets | number | N | Overrides the number of buckets used internally. Default is 2\n cleanupListener | function | N | Calls the function with a storage bucket that's been removed\n retainUsed | boolean | N | Keep items longer than the maxTTL if they are used\n\n#### What limit should I set ?\nIf you expect N keys to be used most frequently, (limit/buckets) >= N\n\n\n## What is it fit for?\n\nCaching in general. When you need to cache results of some long running process or a lot of them and you **don't** have a strong requirement to keep every item until its exact expiry time.\n\n## Technicalities\n\n### How do you know items added to native prototypes won't affect the cache?\n\nObjects used for storing key/value pairs don't inherit from any of the native prototypes, nor `Object`\nThe implementation uses defensive coding to avoid relying on intrinsics that could be modified later.\n\n### What's with the memory leaks, buckets and delete?\n\n`delete` keyword removes fields from objects, but changes the `hidden class` aka `shape` of the object which takes up some memory. As a result, adding and deleting unique fields to a plain JavaScript object may cause memory consumption to grow. Some JavaScript engines had it leak memory in various ways.\n\n*Then how do you remove old items from cache if you can't use delete?*\n\nCache consists of a number of buckets and the oldest bucket is removed when new room is needed. Therefore the oldest (1/buckets) of entries gets removed.\n\nThere's only one interval created per cache instance.\n","readmeFilename":"README.md"}