Index: xcache.php
===================================================================
--- xcache.php	(revision 819)
+++ xcache.php	(working copy)
@@ -68,6 +68,17 @@ class xcacheCache extends Cache {
     if ($expire == CACHE_TEMPORARY) {
       $expire = 180;
     }
+    /*
+     * Drupal's convention of passing an $expires parameter to cache_set is that it will be
+     * a timestamp (i.e. time() + 5 hours). Xcache, however, only accepts the parameter ttl
+     * which is the count of seconds the cached item is allowed to live (i.e. 5 hours). When 
+     * using xcache as the caching engine we must shift the $expires time back to an offset
+     * otherwise the datetime overflows. 
+     */
+    else if ($expire != CACHE_PERMANENT)
+    {
+      $expire = $expire - time() ;
+    }
     // Create new cache object.
     $cache = new stdClass;
     $cache->cid = $key;
