--- engines/apc.php.orig	2009-05-15 10:24:10.000000000 +1200
+++ engines/apc.php	2009-05-15 10:22:00.000000000 +1200
@@ -49,28 +49,33 @@
    * @return bool
    *   Returns TRUE on success or FALSE on failure
    */
   function set($key, $value, $expire = CACHE_PERMANENT, $headers = NULL) {
     if ($expire == CACHE_TEMPORARY) {
-      $expire = 180;
+      $expire = time() + 180;
     }
     // Create new cache object.
     $cache = new stdClass;
     $cache->cid = $key;
     $cache->created = time();
     $cache->expire = $expire;
     $cache->headers = $headers;
 
+    if ($expire != CACHE_PERMANENT) {
+      // Convert Drupal $expire, which is a timestamp, to a TTL for APC
+      $expire -= time();
+    }
     if (!is_string($value)) {
       $cache->serialized = TRUE;
       $cache->data = serialize($value);
     }
     else { 
       $cache->serialized = FALSE;
       $cache->data = $value;
     }
 
+    $return = null;
     if (!empty($key) && $this->lock()) {
       // Get lookup table to be able to keep track of bins
       $lookup = apc_fetch($this->lookup);
 
       // If the lookup table is empty, initialize table
