1.0.12 • Published 4 years ago

@flowx/redis v1.0.12

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

@flowxjs/redis

基于TypeService的Redis缓存框架

Install

$ npm i @flowxjs/redis

Usage

import { cacheable, TypeRedis, buildCache, deleteCache } from '@flowx/redis';

const x = new TypeRedis({
  host: '129.211.10.111',
  memory: true,
});

class ABC {
  @cacheable('test:${0}:ttt:${1}', 3600)
  sum(a: number, b: number) {
    return a + b;
  }
}

const t = new ABC();

Promise.resolve(t.sum(8, 3))
.then(d => console.log('first value:', d))
.then(() => Promise.resolve(t.sum(8, 3)))
.then(d => console.log('cache value:', d))
.then(() => x.get('test:8:ttt:3'))
.then(d => console.log('redirect value:', d))
.then(() => buildCache(ABC, 'sum', 8, 3))
.then(() => t.sum(8, 3))
.then(d => console.log('build value:', d))
.then(() => deleteCache(ABC, 'sum', 8, 3))
.then(() => x.get('test:8:ttt:3'))
.then(d => console.log('delete value:', d));

output:

first value: 11
cache value: 11
redirect value: 11
build value: 11
delete value: undefined
1.0.12

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago