Permalink
Browse files

Added SETEX

  • Loading branch information...
1 parent 5cb2b3f commit 5435062edf6fcfc741590bc36d7fa2698c21fbce @tj committed Apr 15, 2011
Showing with 16 additions and 0 deletions.
  1. +16 −0 lib/commands/string.js
View
@@ -68,6 +68,22 @@ exports.getset = function(client, key, val){
client.bool(true);
}).mutates = true;
+/**
+ * SETEX <key> <seconds> <val>
+ */
+
+(exports.setex = function(client, key, seconds, val){
+ var key = string(key);
+
+ this.db.data[key] = {
+ type: 'string'
+ , val: val
+ , expires: Date.now() + (string(seconds) * 1000)
+ };
+
+ client.bool(true);
+}).mutates = true;
+
/**
* INCR <key>
*/

0 comments on commit 5435062

Please sign in to comment.