setOption() public method

see Cache_Lite constructor for available options
public setOption ( $name, $value )
コード例 #1
0
ファイル: CacheLite.php プロジェクト: verbazend/AWFA
 /**
  * Sets options for Cache_Lite based on the needs of the current method.
  * Options set include the subdirectory to be used, and the expiration.
  * 
  * @param string $key    The sub-directory of the cacheDir
  * @param string $expire The cache lifetime (expire) to be used
  * 
  * @return void
  */
 protected function setOptions($key, $expire = null)
 {
     $cacheDir = $this->options['cacheDir'] . '/oauth/';
     $cacheDir .= rtrim($key, '/') . '/';
     $this->ensureDirectoryExists($cacheDir);
     $this->cache->setOption('cacheDir', $cacheDir);
     $this->cache->setOption('lifeTime', $expire);
 }
コード例 #2
0
ファイル: CacheLite.php プロジェクト: shupp/openid
 /**
  * Sets options for Cache_Lite based on the needs of the current method.
  * Options set include the subdirectory to be used, and the expiration.
  * 
  * @param string $key    The sub-directory of the cacheDir
  * @param string $expire The cache lifetime (expire) to be used
  * 
  * @return void
  */
 protected function setOptions($key, $expire = null)
 {
     $cacheDir = $this->options['cacheDir'] . '/openid/';
     $cacheDir .= rtrim($this->storeDirectories[$key], '/') . '/';
     $this->ensureDirectoryExists($cacheDir);
     $this->cache->setOption('cacheDir', $cacheDir);
     if ($expire !== null) {
         $this->cache->setOption('lifeTime', $expire);
     }
 }
コード例 #3
0
 /**
  * Garbage collect expired cache data
  *
  * @return  boolean
  *
  * @since   11.1
  */
 public function gc()
 {
     $result = true;
     static::$CacheLiteInstance->setOption('automaticCleaningFactor', 1);
     static::$CacheLiteInstance->setOption('hashedDirectoryLevel', 1);
     $success1 = static::$CacheLiteInstance->_cleanDir($this->_root . '/', false, 'old');
     if (!($dh = opendir($this->_root . '/'))) {
         return false;
     }
     while ($file = readdir($dh)) {
         if ($file != '.' && $file != '..' && $file != '.svn') {
             $file2 = $this->_root . '/' . $file;
             if (is_dir($file2)) {
                 $result = $result && static::$CacheLiteInstance->_cleanDir($file2 . '/', false, 'old');
             }
         }
     }
     $success = $success1 && $result;
     return $success;
 }