本文整理汇总了PHP中eZCache::fetchByID方法的典型用法代码示例。如果您正苦于以下问题:PHP eZCache::fetchByID方法的具体用法?PHP eZCache::fetchByID怎么用?PHP eZCache::fetchByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZCache
的用法示例。
在下文中一共展示了eZCache::fetchByID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: purgeItems
purgeItems($cacheEntries, $cli, $tagName);
} else {
clearItems($cacheEntries, $cli, $tagName);
}
}
$idName = false;
if ($options['clear-id']) {
$noAction = false;
$idName = $options['clear-id'];
}
if ($idName) {
$idList = explode(',', $idName);
$missingIDList = array();
$cacheEntries = array();
foreach ($idList as $id) {
$cacheEntry = eZCache::fetchByID($id, $cacheList);
if ($cacheEntry) {
$cacheEntries[] = $cacheEntry;
} else {
$missingIDList[] = $id;
}
}
if (count($missingIDList) > 0) {
$cli->warning('No such cache ID: ' . $cli->stylize('emphasize', implode(', ', $missingIDList)));
$script->shutdown(1);
}
if ($options['clear-id']) {
if ($purge) {
purgeItems($cacheEntries, $cli, $idName);
} else {
clearItems($cacheEntries, $cli, $idName);
示例2: get
/**
* @todo we should return an error if the scalar values are queried without a .0 appendeded...
*/
function get($oid)
{
// warm up list of existing oids, if not yet done
$this->oidList();
$internaloid = preg_replace('/\\.0$/', '', $oid);
if (array_key_exists($internaloid, self::$simplequeries)) {
$count = -1;
if (strpos($internaloid, '2.1.4.') === 0) {
// session-related queries: return -1 if not using db-based storage
$ini = eZINI::instance();
$sessionHandler = $ini->variable('Session', 'Handler');
if ($sessionHandler != 'ezpSessionHandlerDB') {
return array('oid' => $oid, 'type' => eZSNMPd::TYPE_INTEGER, 'value' => $count);
}
}
if (strpos($internaloid, '2.1.6.') === 0) {
// async-publication-related queries: return -1 if not using it
$ini = eZINI::instance('content.ini');
if ($ini->variable('PublishingSettings', 'AsynchronousPublishing') != 'enabled') {
return array('oid' => $oid, 'type' => eZSNMPd::TYPE_INTEGER, 'value' => $count);
}
}
$db = self::eZDBinstance();
if ($db) {
$results = $db->arrayQuery(str_replace('/*anonymousId*/', eZUser::anonymousId(), self::$simplequeries[$internaloid]));
$db->close();
if (is_array($results) && count($results)) {
$count = $results[0]['count'];
}
}
return array('oid' => $oid, 'type' => eZSNMPd::TYPE_INTEGER, 'value' => $count);
}
if (array_key_exists($internaloid, self::$orderstatuslist)) {
$oids = explode('.', $internaloid);
switch ($oids[5]) {
case '1':
return array('oid' => $oid, 'type' => eZSNMPd::TYPE_INTEGER, 'value' => self::$orderstatuslist[$internaloid]);
case '2':
return array('oid' => $oid, 'type' => eZSNMPd::TYPE_STRING, 'value' => self::$orderstatuslist[$internaloid]);
case '3':
case '4':
$count = -1;
$db = self::eZDBinstance();
if ($db) {
$status = $db->arrayQuery('select count(*) as num from ezorder where is_temporary=0 and is_archived=' . ($oids[5] + 1) % 2 . ' and status_id=' . self::$orderstatuslist[$internaloid], array('column' => 'num'));
$db->close();
if (is_array($status) && count($status)) {
$count = $status[0];
}
}
return array('oid' => $oid, 'type' => eZSNMPd::TYPE_INTEGER, 'value' => $count);
}
}
if (array_key_exists($internaloid, self::$cachelist)) {
$cacheinfo = eZCache::fetchByID(self::$cachelist[$internaloid]);
$oids = explode('.', $internaloid);
switch ($oids[3]) {
case '1':
return array('oid' => $oid, 'type' => eZSNMPd::TYPE_STRING, 'value' => $cacheinfo['name']);
case '2':
return array('oid' => $oid, 'type' => eZSNMPd::TYPE_INTEGER, 'value' => (int) $cacheinfo['enabled']);
case '3':
case '4':
$fileINI = eZINI::instance('file.ini');
$handlerName = $fileINI->variable('ClusteringSettings', 'FileHandler');
switch ($handlerName) {
case 'ezfs':
case 'eZFSFileHandler':
case 'eZFS2FileHandler':
break;
default:
// the db-based filehandlers + dfs one not yet supported
return array('oid' => $oid, 'type' => eZSNMPd::TYPE_INTEGER, 'value' => -1);
}
// take care: this is hardcoded from knowledge of cache structure...
if (strpos($cacheinfo['path'], 'var/cache/') === 0) {
$cachedir = $cacheinfo['path'];
} else {
$cachedir = eZSys::cacheDirectory() . '/' . $cacheinfo['path'];
}
if ($oids[3] == '3') {
$out = (int) eZsnmpdTools::countFilesInDir($cachedir);
} else {
$out = (int) eZsnmpdTools::countFilesSizeInDir($cachedir);
}
return array('oid' => $oid, 'type' => eZSNMPd::TYPE_INTEGER, 'value' => $out);
}
}
if (array_key_exists($internaloid, self::$storagedirlist)) {
$oids = explode('.', $internaloid);
switch ($oids[3]) {
case '1':
return array('oid' => $oid, 'type' => eZSNMPd::TYPE_STRING, 'value' => self::$storagedirlist[$internaloid]);
case '2':
case '3':
$fileINI = eZINI::instance('file.ini');
$handlerName = $fileINI->variable('ClusteringSettings', 'FileHandler');
//.........这里部分代码省略.........