Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredwray committed Feb 12, 2025
1 parent d399afa commit b609117
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/flat-cache/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,14 @@ cache.setKey('key', 'value');

This will save the data to disk every 5 minutes and will remove any data that has not been accessed in 1 hour or if the cache has more than 10,000 items. The `expirationInterval` will check every 5 minutes for expired items and evict them. This is replacement to the `save()` method with a `prune` option as it is no longer needed due to the fact that the in-memory cache handles pruning by `ttl` expiration or `lruSize` which will keep the most recent there.

here is an example doing load from already existing persisted cache
here is an example doing load from already existing persisted cache using the `createFromFile` function:

```javascript
import { createFromFile } from 'flat-cache';
const cache = createFromFile('./cacheAltDirectory/cache1');
```

You can also use the legacy load function to do this:

```javascript
import { FlatCache } from 'flat-cache';
Expand Down

0 comments on commit b609117

Please sign in to comment.