示例#1
0
 /**
  * Initialization for the cache.
  * 
  * @param string $desired - the given cache implementation library
  * @param string $basekey unique cache id (md5 hashed board url + source file time stamp)
  * @param array $memcached_hosts - array of memcached hosts, if passed
  * @param string $cachedir - cache directory (relevant for file caching only)
  */
 public static function init($desired, $basekey, $memcached_hosts, $cachedir)
 {
     global $db_show_debug;
     self::$basekey = $basekey;
     self::$memcached_hosts = $memcached_hosts;
     self::$cachedir = $cachedir;
     self::$want_debug = isset($db_show_debug) && $db_show_debug === true ? true : false;
     if ($desired == 'apc' && function_exists('apc_store')) {
         self::$API = 1;
     } elseif ($desired == 'xcache' && function_exists('xcache_get') && ini_get('xcache.var_size') > 0) {
         self::$API = 2;
     } elseif ($desired == 'zend' && function_exists('output_cache_get')) {
         self::$API = 3;
     } elseif ($desired == 'memcache' && function_exists('memcache_get')) {
         self::$API = 4;
     } elseif ($desired == 'new_memcache' && class_exists('Memcached')) {
         self::$API = 5;
     } elseif ($desired == 'file') {
         self::$API = 0;
     }
 }