本文整理汇总了PHP中Cache_Lite::setOption方法的典型用法代码示例。如果您正苦于以下问题:PHP Cache_Lite::setOption方法的具体用法?PHP Cache_Lite::setOption怎么用?PHP Cache_Lite::setOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cache_Lite
的用法示例。
在下文中一共展示了Cache_Lite::setOption方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setOptions
/**
* 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: setOptions
/**
* 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: gc
/**
* 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;
}