コード例 #1
0
 /**
  * The constructor for the BCMAPICache class.
  * @access Public
  * @since 1.0.0
  * @param string [$type] The type of caching method to use, either 'file' or 'memcached'
  * @param int [$time] How many seconds until cache files are considered cold
  * @param string [$location] The absolute path of the cache directory (file) or host (memcached)
  * @param string [$extension] The file extension for cache items (file only)
  * @param int [$port] The port to use (Memcached only)
  */
 public function __construct($type = 'file', $time = 600, $location, $extension = '.c', $port = 11211)
 {
     if (strtolower($type) == 'file') {
         $type = 'file';
     } else {
         if (strtolower($type) == 'memcache' || strtolower($type) == 'memcached') {
             $type = 'memcached';
             $memcached = new Memcached();
             $memcached->addServer($location, $port);
             self::$memcached = $memcached;
         } else {
             $type = FALSE;
         }
     }
     self::$extension = $extension;
     self::$location = $location;
     self::$port = $port;
     self::$time = $time;
     self::$type = $type;
 }