Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/koatty/koatty_cacheable
Cacheable for koatty.
https://github.com/koatty/koatty_cacheable
cache components koa koatty memorycache redis-cache
Last synced: 10 days ago
JSON representation
Cacheable for koatty.
- Host: GitHub
- URL: https://github.com/koatty/koatty_cacheable
- Owner: Koatty
- License: bsd-3-clause
- Created: 2020-07-06T11:50:17.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-04-01T07:47:54.000Z (10 months ago)
- Last Synced: 2024-05-02T10:21:57.627Z (9 months ago)
- Topics: cache, components, koa, koatty, memorycache, redis-cache
- Language: TypeScript
- Homepage:
- Size: 621 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# koatty_cacheable
Cacheable for koatty.Koatty框架的 CacheAble, Cacheable, CacheEvict 支持库
# Usage
db.ts in koatty project:
```js
export default {
..."CacheStore": {
type: "memory", // redis or memory, memory is default
// key_prefix: "koatty",
// host: '127.0.0.1',
// port: 6379,
// name: "",
// username: "",
// password: "",
// db: 0,
// timeout: 30,
// pool_size: 10,
// conn_timeout: 30
},...
};```
used in service:
```js
import { CacheAble, CacheEvict, GetCacheStore } from "koatty_cacheable";export class TestService {
@CacheAble("testCache") // auto cached
getTest(){
//todo
}@CacheEvict("testCache") // auto clear cache
setTest(){
//todo
}test(){
const store = GetCacheStore(this.app);
store.set(key, value);
}
}```