Skip to content

Commit

Permalink
set expiration for key index nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
Hassan Abdel-Rahman committed Apr 29, 2017
1 parent 32fae72 commit 607cfbf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const redis = require('redis');

const FIVE_MINUTES = 5 * 60;
const ONE_HOUR = 12 * FIVE_MINUTES;

class RedisCache {
constructor(options) {
Expand Down Expand Up @@ -91,6 +92,7 @@ class RedisCache {
.set(key, body)
.set(keyIndex, JSON.stringify(keys))
.expire(key, this.expiration)
.expire(keyIndex, ONE_HOUR)
.exec(err => {
if (err) {
rej(err);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fastboot-redis-cache",
"version": "0.1.1",
"version": "0.1.2",
"description": "A FastBoot App Server cache for Redis",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 607cfbf

Please sign in to comment.