X-Git-Url: https://git.josue.xyz/?p=dotfiles%2F.git;a=blobdiff_plain;f=.config%2Fcoc%2Fextensions%2Fnode_modules%2Fcoc-prettier%2Fnode_modules%2Flru-cache%2FREADME.md;h=435dfebb7e27d0d8a7c00105c34eb9af0aeba262;hp=d660dd5747abecfcbaf3ba8ea74dd2c236c4c15c;hb=4d07c77cf4d78cab8639e13ddc3c22495e585b0b;hpb=b3950616b54221c40a7dab9099bda675007e5b6e diff --git a/.config/coc/extensions/node_modules/coc-prettier/node_modules/lru-cache/README.md b/.config/coc/extensions/node_modules/coc-prettier/node_modules/lru-cache/README.md index d660dd57..435dfebb 100644 --- a/.config/coc/extensions/node_modules/coc-prettier/node_modules/lru-cache/README.md +++ b/.config/coc/extensions/node_modules/coc-prettier/node_modules/lru-cache/README.md @@ -18,8 +18,8 @@ var LRU = require("lru-cache") , length: function (n, key) { return n * 2 + key.length } , dispose: function (key, n) { n.close() } , maxAge: 1000 * 60 * 60 } - , cache = LRU(options) - , otherCache = LRU(50) // sets just the max size + , cache = new LRU(options) + , otherCache = new LRU(50) // sets just the max size cache.set("key", "value") cache.get("key") // "value" @@ -49,10 +49,13 @@ away. * `max` The maximum size of the cache, checked by applying the length function to all values in the cache. Not setting this is kind of silly, since that's the whole purpose of this lib, but it defaults - to `Infinity`. + to `Infinity`. Setting it to a non-number or negative number will + throw a `TypeError`. Setting it to 0 makes it be `Infinity`. * `maxAge` Maximum age in ms. Items are not pro-actively pruned out as they age, but if you try to get an item that is too old, it'll drop it and return undefined instead of giving it to you. + Setting this to a negative value will make everything seem old! + Setting it to a non-number will throw a `TypeError`. * `length` Function that is used to calculate the length of stored items. If you're storing strings or buffers, then you probably want to do something like `function(n, key){return n.length}`. The default is @@ -76,6 +79,11 @@ away. it'll be called whenever a `set()` operation overwrites an existing key. If you set this option, `dispose()` will only be called when a key falls out of the cache, not when it is overwritten. +* `updateAgeOnGet` When using time-expiring entries with `maxAge`, + setting this to `true` will make each item's effective time update + to the current time whenever it is retrieved from cache, causing it + to not expire. (It can still fall out of cache based on recency of + use, of course.) ## API