File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,19 +28,13 @@ Imagine your cache is a box that can only fit a certain number of items. When th
28284 . If the program needs something, it checks the cache first before doing extra work.
2929
3030
31- ## For Developers
32-
33- Below are technical details and code examples for those who want to use Tiny LRU in their code.
34-
35- ### Using Tiny LRU in Code
36-
37- #### Using the factory
31+ ## Using the factory
3832``` javascript
3933import {lru } from " tiny-lru" ;
4034const cache = lru (max, ttl = 0 , resetTtl = false );
4135```
4236
43- #### Using the Class
37+ ## Using the Class
4438``` javascript
4539import {LRU } from " tiny-lru" ;
4640const cache = new LRU (max, ttl = 0 , resetTtl = false );
@@ -51,18 +45,17 @@ import {LRU} from "tiny-lru";
5145class MyCache extends LRU {}
5246```
5347
54- #### Interoperability
48+ ## Interoperability
5549Lodash provides a ` memoize ` function with a cache that can be swapped out as long as it implements the right interface.
5650See the [ lodash docs] ( https://lodash.com/docs#memoize ) for more on ` memoize ` .
5751
58- Example:
5952``` javascript
6053_ .memoize .Cache = lru ().constructor ;
6154const memoized = _ .memoize (myFunc);
6255memoized .cache .max = 10 ;
6356```
6457
65- #### Testing
58+ ## Testing
6659Tiny-LRU has 100% code coverage with its tests.
6760
6861``` console
You can’t perform that action at this time.
0 commit comments