--- memcache.orig.inc	2009-09-01 11:14:12.000000000 +0100
+++ memcache.inc	2010-02-23 18:27:09.000000000 +0000
@@ -26,11 +26,17 @@ function cache_get($cid, $table = 'cache
     $cache_tables = isset($_SESSION['cache_flush']) ? $_SESSION['cache_flush'] : NULL;
     // Items cached before the cache was last flushed are no longer valid.
     $cache_lifetime = variable_get('cache_lifetime', 0);
-    if ($cache_lifetime && $cache->created && $cache_flush &&
-        ($cache->created < $cache_flush) &&
-        ((time() - $cache->created >= $cache_lifetime)) ||
-        (is_array($cache_tables) && $cache_tables[$table] &&
-        $cache_tables[$table] > $cache->created)) {
+    
+    if ($cache_lifetime && 
+        $cache->created && 
+        $cache->expire != CACHE_PERMANENT && 
+        (
+          ($cache->expire && $cache->expire < time()) ||
+          ($cache_flush && $cache->created < $cache_flush) ||
+          ($cache->expire == CACHE_TEMPORARY && (time() - $cache->created) >= $cache_lifetime) ||
+          (is_array($cache_tables) && $cache_tables[$table] && $cache_tables[$table] > $cache->created))
+        ) {
+        
       // Cache item expired, return NULL.
       return 0;
     }
