Skip to content
This repository was archived by the owner on Oct 13, 2025. It is now read-only.

Commit db1c3ac

Browse files
committed
Merge branch 'renaudfv-master'
2 parents 0bccef4 + 265aee6 commit db1c3ac

File tree

9 files changed

+1401
-501
lines changed

9 files changed

+1401
-501
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ coverage.lcov
2020

2121

2222
# Compiled files
23-
lib/
23+
# lib/
2424

2525
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
2626
.grunt

README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,24 @@ Each request to an endpoint can be cached. Route variables and params are cached
3030

3131
The cache can be purged for an individual route, but also for a group of routes. This is very useful if you have an API endpoint that creates a list of articles, and an endpoint that returns an individual article. If the article is modified, the list of articles should, most likely, be purged as well. This can be done by calling one endpoint.
3232

33+
### Routes exemples
3334
In the same fashion if you have many variants of the same endpoint that return similar content based on parameters you can bust the whole group as well:
3435

3536
```js
3637
'/articles' // list
3738
'/articles/article' //individual item
3839
'/articles/article?markdown=true' // variant
3940
```
41+
#### Clearing cache
42+
These are all listed in a redis list under `group-articles` and can be busted by calling `/cache/clear/group/article` or `/cache/clear/group/articles` it does not matter. All urls keys will be purged.
4043

41-
These are all listed in a redis list under `group-articles` and can be busted by calling `/cache/clear/group/article` or `/cache/clear/group/articles` it does not matter. All urls will be purged.
42-
43-
It was meant to be used over http, not yet tested with sockets.
44+
You can also purge single cached paths as by doing GET requests on
45+
```js
46+
'/cache/clear/single/articles'
47+
'/cache/clear/single/articles/article'
48+
'/cache/clear/single/articles/article?markdown=true' // works with query strings too
49+
```
50+
It was meant to be used over **_HTTP_**, not yet tested with sockets.
4451

4552
## Available hooks
4653
More details and example use bellow
@@ -51,7 +58,7 @@ More details and example use bellow
5158
### After
5259
* `hookCache` - set defaults caching duration, an object can be passed with the duration in seconds
5360
* `redisAfterHook` - saves to redis
54-
* `hookRemoveCacheInformation` - removes the cache object
61+
* `hookRemoveCacheInformation` - removes the cache object from responses (does not clear from Redis)
5562

5663

5764
## Documentation

lib/library.min.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/library.min.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)