https://github.com/glebmachine/node-localcache
LocalStorage with optional json file cache
https://github.com/glebmachine/node-localcache
Last synced: about 1 month ago
JSON representation
LocalStorage with optional json file cache
- Host: GitHub
- URL: https://github.com/glebmachine/node-localcache
- Owner: glebmachine
- License: mit
- Created: 2015-12-13T19:47:22.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-05-31T21:43:10.000Z (almost 8 years ago)
- Last Synced: 2025-03-08T08:17:51.238Z (3 months ago)
- Language: JavaScript
- Size: 43.9 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 157
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Node LocalCache [](https://travis-ci.org/glebmachine/node-localcache) [](http://badge.fury.io/js/node-localcache)
Module, allows to save application data between launches in json data file. Api most liked as LocalStorage API
## Usage
```js
var LocalCache = require('node-localcache');cache = new LocalCache('.cache/filetocache.json');
cache.setItem('key', 'value');
cache.getItem('key'); // value
```## Options
```js
new LocalCache(fileName, skipFileCaching);
```
- `fileName` - (optional with `skipFileCaching`: `true`) Path to cache file, also used as store `id`
- `skipFileCaching` - (optional) disable file cache, default `false`## FS Perfomance
All manipulation agregating and applying 1 time per second. But, don't panic, on nodejs exit, everything will be saved into file.