本文整理匯總了PHP中cachemgr::cachemgr方法的典型用法代碼示例。如果您正苦於以下問題:PHP cachemgr::cachemgr方法的具體用法?PHP cachemgr::cachemgr怎麽用?PHP cachemgr::cachemgr使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cachemgr
的用法示例。
在下文中一共展示了cachemgr::cachemgr方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: cachedir
function cachedir()
{
$system =& $GLOBALS['system'];
$this->db =& $system->database();
$this->totalBytes = 15 << 20;
$row = $this->db->selectrow('select sum(cache_size) as size from sdb_cachedir');
if (false === $row) {
$this->db->exec('drop table if exists sdb_cachedir', 1, 1);
$sql = <<<EOF
create table sdb_cachedir
(
cache_file varchar(32) not null,
cache_size mediumint unsigned not null,
last_update int unsigned not null,
primary key (cache_file)
)type = MyISAM
EOF;
$this->db->exec($sql, 1, 1);
} else {
$this->curBytes = $row['size'];
if ($row['size'] > $this->totalBytes) {
$this->_free(10, $row['size'] - $this->totalBytes);
}
}
parent::cachemgr();
}
示例2: memcached
function memcached()
{
if (!class_exists('Memcache')) {
trigger_error('Missing php_memcache module', E_USER_ERROR);
}
$this->obj = new Memcache();
if (!$this->obj->connect(MEMCACHED_HOST, MEMCACHED_PORT)) {
trigger_error('Can\'t connect memcached server', E_USER_ERROR);
}
parent::cachemgr();
}
示例3: Memcache
function cache_memcache()
{
if (!class_exists('Memcache')) {
trigger_error('Missing php_memcache module', E_USER_ERROR);
}
$this->obj = new Memcache();
$ports = explode(',', MEMCACHED_PORT);
foreach (explode(',', MEMCACHED_HOST) as $i => $h) {
if (!$this->obj->addServer($h, $ports[0])) {
trigger_error('Can\'t connect memcached server', E_USER_ERROR);
}
}
$this->obj->pconnect();
parent::cachemgr();
}