Permalink
Browse files

Added EXPIRE

  • Loading branch information...
1 parent 9ac3a2c commit 2e1b0323780cacb4ad6c270256559440b127b536 @tj committed Apr 15, 2011
Showing with 16 additions and 0 deletions.
  1. +16 −0 lib/commands/keys.js
View
@@ -13,6 +13,22 @@ var utils = require('../utils')
, string = utils.string;
/**
+ * EXPIRE <key> <seconds>
+ */
+
+exports.expire = function(client, key, seconds){
+ var key = string(key)
+ , obj = this.db.data[key];
+
+ if (obj) {
+ obj.ttl = Date.now() + Number(string(seconds));
+ client.bool(true);
+ } else {
+ client.bool(false);
+ }
+};
+
+/**
* EXPIREAT <key> <seconds>
*/

0 comments on commit 2e1b032

Please sign in to comment.