本文整理汇总了PHP中eaccelerator_gc函数的典型用法代码示例。如果您正苦于以下问题:PHP eaccelerator_gc函数的具体用法?PHP eaccelerator_gc怎么用?PHP eaccelerator_gc使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eaccelerator_gc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: disconnect
/**
* Disconnect from remote cache store
*
* @return @e boolean
*/
public function disconnect()
{
if (function_exists('eaccelerator_gc')) {
eaccelerator_gc();
}
return true;
}
示例2: clean
public function clean()
{
eaccelerator_clean();
eaccelerator_clear();
eaccelerator_gc();
eaccelerator_purge();
return;
}
示例3: flushAll
/**
* Deletes all EAccelerator data cache
*/
public function flushAll()
{
//delete expired content then delete all
eaccelerator_gc();
$idkeys = eaccelerator_list_keys();
foreach ($idkeys as $k) {
$this->flush(substr($k['name'], 1));
}
}
示例4: clear
public function clear()
{
if (!CACHE_STATUS) {
return false;
}
eaccelerator_gc();
foreach (eaccelerator_list_keys() as $key) {
cache_delete_callback(substr($key["name"], 1));
}
}
示例5: flush
/**
* 清空cache中所有项, 全部清除需要遍历cache,一个一个删除!
* @return void
* @access public
*/
public static function flush()
{
// 清除过期的key
eaccelerator_gc();
// 遍历key,一个一个删除
$list = eaccelerator_list_keys();
foreach ($list as $k => $v) {
self::delete($v['name']);
}
}
示例6: clear
public function clear()
{
if (!_cacheStatus) {
return FALSE;
}
eaccelerator_gc();
foreach (eaccelerator_list_keys() as $key) {
cache_delete_callback(substr($key["name"], 1));
}
}
示例7: flush
public function flush()
{
// first, remove expired content from cache
eaccelerator_gc();
// now, remove leftover cache-keys
$keys = eaccelerator_list_keys();
foreach ($keys as $key) {
$this->deleteValue(substr($key['name'], 1));
}
}
示例8: clean
/**
* @see sfCache
*/
public function clean($mode = sfCache::ALL)
{
if (sfCache::OLD === $mode) {
return eaccelerator_gc();
}
$infos = eaccelerator_list_keys();
if (is_array($infos)) {
foreach ($infos as $info) {
if (false !== strpos($info['name'], $this->getOption('prefix'))) {
// eaccelerator bug (http://eaccelerator.net/ticket/287)
$key = 0 === strpos($info['name'], ':') ? substr($info['name'], 1) : $info['name'];
if (!eaccelerator_rm($key)) {
return false;
}
}
}
}
return true;
}
示例9: tidy
/**
* {@inheritDoc}
*/
function tidy()
{
global $config;
eaccelerator_gc();
$config->set('cache_last_gc', time(), false);
}
示例10: delete_expired
public function delete_expired()
{
eaccelerator_gc();
}
示例11: gc
/**
* Garbage collect stale sessions from the SessionHandler backend.
*
* @access public
* @param integer $maxlifetime The maximum age of a session.
* @return boolean True on success, false otherwise.
*/
function gc($maxlifetime)
{
eaccelerator_gc();
return true;
}
示例12: gc
/**
* Garbage collect expired cache data
*
* @access public
* @return boolean True on success, false otherwise.
*/
function gc()
{
return eaccelerator_gc();
}
示例13: smarty_cache_eaccelerator
/**
* Smarty Cache Handler<br>
* utilizing eAccelerator extension (http://eaccelerator.net/HomeUk)<br>
*
* Name: smarty_cache_eaccelerator<br>
* Type: Cache Handler<br>
* Purpose: Replacement for the file based cache handling of Smarty. smarty_cache_eaccelerator() is
* using Turck eaccelerator extension to minimize disk usage.
* File: cache.eaccelerator.php<br>
* Date: Dec 2, 2003<br>
*
* Usage Example<br>
* <pre>
* $smarty = new Smarty;
* $smarty->cache_handler_func = 'smarty_cache_eaccelerator';
* $smarty->caching = true;
* $smarty->display('index.tpl');
* </pre>
*
* @author André Rabold
* @version RC-1
*
* @param string $action Cache operation to perform ( read | write | clear )
* @param mixed $smarty Reference to an instance of Smarty
* @param string $cache_content Reference to cached contents
* @param string $tpl_file Template file name
* @param string $cache_id Cache identifier
* @param string $compile_id Compile identifier
* @param integer $exp_time Expiration time
* @return boolean TRUE on success, FALSE otherwise
*
* @link http://eaccelerator.net/HomeUk
* (eaccelerator homepage)
* @link http://smarty.php.net/manual/en/section.template.cache.handler.func.php
* (Smarty online manual)
*/
function smarty_cache_eaccelerator($action, &$smarty, &$cache_content, $tpl_file=null, $cache_id=null, $compile_id=null, $exp_time=null)
{
if(!function_exists("eaccelerator")) {
$smarty->trigger_error("cache_handler: PHP Extension \"eaccelerator\" (http://eaccelerator.net/HomeUk) not installed.");
return false;
}
// Create unique cache id:
// We are using smarty's internal functions here to be as compatible as possible.
$_auto_id = $smarty->_get_auto_id($cache_id, $compile_id);
$_cache_file = substr($smarty->_get_auto_filename(".", $tpl_file, $_auto_id),2);
$eaccelerator_id = "smarty_eaccelerator|".$_cache_file;
// The index contains all stored cache ids in a hierarchy and can be iterated later
$eaccelerator_index_id = "smarty_eaccelerator_index";
switch ($action) {
case 'read':
// read cache from shared memory
$cache_content = eaccelerator_get($eaccelerator_id);
if (!is_null($cache_content) && _eaccelerator_hasexpired($cache_content)) {
// Cache has been expired so we clear it now by calling ourself with another parameter :)
$cache_content = null;
smarty_cache_eaccelerator('clear', $smarty, $cache_content, $tpl_file, $cache_id, $compile_id);
}
$return = true;
break;
case 'write':
// save cache to shared memory
$current_time = time();
if (is_null($exp_time) || $exp_time < $current_time)
$ttl = 0;
else
$ttl = $exp_time - time();
// First run garbage collection
eaccelerator_gc();
// Put content into cache
eaccelerator_lock($eaccelerator_id);
eaccelerator_put($eaccelerator_id, $cache_content, $ttl);
// Create an index association
eaccelerator_lock($eaccelerator_index_id);
$eaccelerator_index = eaccelerator_get($eaccelerator_index_id);
if (!is_array($eaccelerator_index))
$eaccelerator_index = array();
$indexes = explode(DIRECTORY_SEPARATOR, $_cache_file);
$_pointer =& $eaccelerator_index;
foreach ($indexes as $index) {
if (!isset($_pointer[$index]))
$_pointer[$index] = array();
$_pointer =& $_pointer[$index];
}
$_pointer = $eaccelerator_id;
eaccelerator_put($eaccelerator_index_id, $eaccelerator_index, 0);
eaccelerator_unlock($eaccelerator_index_id);
eaccelerator_unlock($eaccelerator_id);
break;
//.........这里部分代码省略.........
示例14: flush
public function flush()
{
eaccelerator_gc();
eaccelerator_clear();
eaccelerator_removed_scripts();
}
示例15: gc
public function gc($force)
{
if (rand(1, Cache::GC_DIVISOR) < Cache::GC_PROBABILITY || $force) {
eaccelerator_gc();
}
}