diff --git a/sites/default/modules/memcache/.memcache.inc.swp b/sites/default/modules/memcache/.memcache.inc.swp
index 518bc10..fc22a3c 100644
Binary files a/sites/default/modules/memcache/.memcache.inc.swp and b/sites/default/modules/memcache/.memcache.inc.swp differ
diff --git a/sites/default/modules/memcache/memcache.inc b/sites/default/modules/memcache/memcache.inc
index 52fe16e..d773dba 100644
--- a/sites/default/modules/memcache/memcache.inc
+++ b/sites/default/modules/memcache/memcache.inc
@@ -70,13 +70,17 @@ function cache_set($cid, $data, $table = 'cache', $expire = CACHE_PERMANENT, $he
   $cache->cid = $cid;
   $cache->data = is_object($data) ? memcache_clone($data) : $data;
   $cache->created = $created;
-  $cache->expire = $expire;
+  // Expire time is in seconds if less than 30 days, otherwise is a timestamp.
+  if ($expire != CACHE_PERMANENT && $expire < 2592000) {
+    // Expire is expressed in seconds, convert to the proper future timestamp
+    // as expected in dmemcache_get().
+    $cache->expire = time() + $expire;
+  }
+  else {
+    $cache->expire = $expire;
+  }
   $cache->headers = $headers;
 
-  // Save to memcache
-  if ($expire == CACHE_TEMPORARY) {
-    $expire = 2591999;
-  }
   // We manually track the expire time in $cache->expire.  When the object
   // expires, we only allow one request to rebuild it to avoid cache stampedes.
   // Other requests for the expired object while it is still being rebuilt get
