Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thinkjs/think-cache-file
Use file to cache data for Think 3.x
https://github.com/thinkjs/think-cache-file
cache think-adapter thinkjs3
Last synced: about 1 month ago
JSON representation
Use file to cache data for Think 3.x
- Host: GitHub
- URL: https://github.com/thinkjs/think-cache-file
- Owner: thinkjs
- License: mit
- Created: 2017-03-11T13:32:42.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2021-07-02T00:14:25.000Z (over 3 years ago)
- Last Synced: 2024-10-02T16:37:35.256Z (2 months ago)
- Topics: cache, think-adapter, thinkjs3
- Language: JavaScript
- Homepage:
- Size: 26.4 KB
- Stars: 1
- Watchers: 10
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- think-awesome - think-cache-file
README
# think-cache-file
[![Build Status](https://travis-ci.org/thinkjs/think-cache-file.svg?branch=master)](https://travis-ci.org/thinkjs/think-cache-file)
[![Coverage Status](https://coveralls.io/repos/github/thinkjs/think-cache-file/badge.svg?branch=master)](https://coveralls.io/github/thinkjs/think-cache-file?branch=master)
[![npm](https://img.shields.io/npm/v/think-cache-file.svg?style=flat-square)](https://www.npmjs.com/package/think-cache-file)Use file to cache data
## Install
```
npm install think-cache-file
```## How to Usage
edit config file `src/config/adapter.js`, add options:
```js
const fileCache = require('think-cache-file');
exports.cache = {
type: 'file',
common: {
timeout: 24 * 60 * 60 * 1000, // millisecond
},
file: {
handle: fileCache,
cachePath: '/home/usr/data', // absolute path is necessarily required
pathDepth: 1,
gcInterval: 24 * 60 * 60 * 1000 // gc
}
}
```