Skip to content

Commit 5b6f4a8

Browse files
committed
initial commit from cache-manager-fs@1.0.5
1 parent e0f6807 commit 5b6f4a8

File tree

5 files changed

+1016
-1
lines changed

5 files changed

+1016
-1
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# IDEA files
2+
.idea
3+
*.iml
4+
15
# Logs
26
logs
37
*.log

README.md

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,70 @@
11
# node-cache-manager-fs-binary
2-
Node Cache Manager store for filesystem with faster binary data stored as separate files
2+
Node Cache Manager store for Filesystem with binary data
3+
========================================================
4+
5+
The Filesystem store for the [node-cache-manager](https://github.com/BryanDonovan/node-cache-manager) module.
6+
7+
Installation
8+
------------
9+
10+
```sh
11+
npm install cache-manager-fs-binary --save
12+
```
13+
14+
Usage examples
15+
--------------
16+
17+
Here are examples that demonstrate how to implement the Filesystem cache store.
18+
19+
20+
## Features
21+
22+
* limit maximum size on disk
23+
* refill cache on startup (in case of application restart)
24+
25+
## Single store
26+
27+
```javascript
28+
// node cachemanager
29+
var cacheManager = require('cache-manager');
30+
// storage for the cachemanager
31+
var fsStore = require('cache-manager-fs-binary');
32+
// initialize caching on disk
33+
var diskCache = cacheManager.caching({store: fsStore, options: {ttl: 60*60 /* seconds */, maxsize: 1000*1000*1000 /* max size in bytes on disk */, path:'diskcache', preventfill:true}});
34+
```
35+
36+
### Options
37+
38+
options for store initialization
39+
40+
```javascript
41+
42+
options.ttl = 60; // time to life in seconds
43+
options.path = 'cache/'; // path for cached files
44+
options.preventfill = false; // prevent filling of the cache with the files from the cache-directory
45+
options.fillcallback = null; // callback fired after the initial cache filling is completed
46+
options.zip = false; // if true the cached files will be zipped to save diskspace
47+
options.bufferReviver = true; // if true buffers are returned from cache as buffers, not objects
48+
49+
```
50+
## Installation
51+
52+
npm install cache-manager-fs-binary
53+
54+
## Tests
55+
56+
To run tests:
57+
58+
npm test
59+
60+
## Code Coverage
61+
62+
To run Coverage:
63+
64+
npm run coverage
65+
66+
## License
67+
68+
cache-manager-fs-binary is licensed under the MIT license.
69+
70+
Based on https://github.com/hotelde/node-cache-manager-fs

0 commit comments

Comments
 (0)