File tree Expand file tree Collapse file tree 5 files changed +97
-8
lines changed
Expand file tree Collapse file tree 5 files changed +97
-8
lines changed Original file line number Diff line number Diff line change 11# Cache Layer
22
3- > A cache abstraction for many providers
3+ > An abstraction for cache providers, it exposes a common interface for diferente ways of cache
44
55** It suports**
66
Original file line number Diff line number Diff line change 1+ # Cache Layer
2+
3+ > An abstraction for cache providers, it exposes a common interface for diferente ways of cache
4+
5+ ** It suports**
6+
7+ - Redis
8+ - In memory
9+
10+ [ ![ Build Status] ( http://img.shields.io/travis/badges/badgerbadgerbadger.svg?style=flat-square )] ( https://travis-ci.org/badges/badgerbadgerbadger ) [ ![ Dependency Status] ( http://img.shields.io/gemnasium/badges/badgerbadgerbadger.svg?style=flat-square )] ( https://gemnasium.com/badges/badgerbadgerbadger ) [ ![ Coverage Status] ( http://img.shields.io/coveralls/badges/badgerbadgerbadger.svg?style=flat-square )] ( https://coveralls.io/r/badges/badgerbadgerbadger ) [ ![ Code Climate] ( http://img.shields.io/codeclimate/github/badges/badgerbadgerbadger.svg?style=flat-square )] ( https://codeclimate.com/github/badges/badgerbadgerbadger )
11+
12+ ## Sumary
13+
14+ - [ Installation] ( #installation )
15+ - [ Usage] ( #usage )
16+ - [ Features] ( #features )
17+ - [ License] ( #license )
18+
19+ ---
20+
21+ ## Installation
22+
23+ ``` shell
24+ $ npm install cache-layer --save
25+ ```
26+
27+ ## Usage
28+
29+ #### InMemory
30+
31+ ``` javascript
32+ const client = Cache .create ({
33+ provider: ' in-memory' ,
34+ ttl: 2000 // a defautt TTL (miliseconds)
35+ });
36+
37+ // or you can provide a specific TTL
38+ const done = await client .add (' hashKey' , { name: ' John' }, 1000 );
39+ const result = await client .get (' hashKey' );
40+ ```
41+
42+ #### Redis
43+
44+ ``` javascript
45+ const client = Cache .create ({
46+ provider: ' redis' ,
47+ host: ' redis.com.br' ,
48+ container: ' cache' ,
49+ port: 6379 ,
50+ ttl: 2000 , // a defautt TTL (miliseconds)
51+ db: 0 ,
52+ keyPrefix: ' cache:' ,
53+ lazyConnect: true ,
54+ maxRetriesPerRequest: 0
55+ });
56+
57+ // or you can provide a specific TTL
58+ const done = await client .add (' hashKey' , { name: ' John' }, 1000 );
59+ const result = await client .get (' hashKey' );
60+ ```
61+
62+ ## Features
63+
64+ ## License
65+
66+ [ ![ License] ( http://img.shields.io/:license-mit-blue.svg?style=flat-square )] ( http://badges.mit-license.org )
67+
68+ - ** [ MIT license] ( http://opensource.org/licenses/mit-license.php ) **
Original file line number Diff line number Diff line change 11{
22 "name" : " cache-layer" ,
3- "version" : " 1.0.3 " ,
4- "description" : " This package creates a cache provider instance " ,
3+ "version" : " 1.0.6 " ,
4+ "description" : " An abstraction for cache providers, it exposes a common interface for diferente ways of cache " ,
55 "main" : " index.js" ,
66 "scripts" : {
77 "build" : " tsc && node setup.js" ,
8- "dist " : " npm run build && cd dist && npm publish" ,
8+ "publish " : " rm dist -rf && npm run build && cd dist && npm publish" ,
99 "test" : " mocha -b -w --recursive --require ts-node/register --watch-extensions ts \" tests/setup.ts\" " ,
1010 "test:unit:pipeline" : " mocha -b --require ts-node/register --watch-extensions ts \" tests/setup.ts\" "
1111 },
1212 "author" : " Albo Vieira" ,
13+ "homepage" : " https://github.com/albovieira/cache-layer#readme" ,
14+ "repository" : {
15+ "type" : " git" ,
16+ "url" : " https://github.com/albovieira/cache-layer.git"
17+ },
1318 "license" : " MIT" ,
1419 "devDependencies" : {
1520 "@types/chai" : " ^4.1.6" ,
Original file line number Diff line number Diff line change 11{
22 "name" : " cache-layer" ,
3- "version" : " 1.0.3 " ,
4- "description" : " This package creates a cache provider instance " ,
3+ "version" : " 1.0.6 " ,
4+ "description" : " An abstraction for cache providers, it exposes a common interface for diferente ways of cache " ,
55 "main" : " index.js" ,
66 "scripts" : {
77 "build" : " tsc && node setup.js" ,
8- "dist " : " npm run build && cd dist && npm publish" ,
8+ "publish " : " rm dist -rf && npm run build && cd dist && npm publish" ,
99 "test" : " mocha -b -w --recursive --require ts-node/register --watch-extensions ts \" tests/setup.ts\" " ,
1010 "test:unit:pipeline" : " mocha -b --require ts-node/register --watch-extensions ts \" tests/setup.ts\" "
1111 },
1212 "author" : " Albo Vieira" ,
13+ "homepage" : " https://github.com/albovieira/cache-layer#readme" ,
14+ "repository" : {
15+ "type" : " git" ,
16+ "url" : " https://github.com/albovieira/cache-layer.git"
17+ },
18+ "keywords" : [
19+ " cache" ,
20+ " cache-manager" ,
21+ " abstraction" ,
22+ " memcache" ,
23+ " redis" ,
24+ " cache-provider"
25+ ],
1326 "license" : " MIT" ,
1427 "devDependencies" : {
1528 "@types/chai" : " ^4.1.6" ,
Original file line number Diff line number Diff line change @@ -10,5 +10,8 @@ fs.copy('.npmrc', 'dist/.npmrc')
1010 . then ( c => console . log ( '.npmrc copied successfully!' ) )
1111 . catch ( e => console . log ( `Error copying .npmrc, Details: ${ e } ` ) ) ;
1212
13+ fs . copy ( 'README.md' , 'dist/README.md' )
14+ . then ( c => console . log ( 'README.md copied successfully!' ) )
15+ . catch ( e => console . log ( `Error copying README.md, Details: ${ e } ` ) ) ;
1316
14- console . log ( 'Done! Package ready to publish.' ) ;
17+ console . log ( 'Done! Package ready to publish.' ) ;
You can’t perform that action at this time.
0 commit comments