當前位置: 首頁>>代碼示例>>PHP>>正文


PHP eZCache::fetchByID方法代碼示例

本文整理匯總了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);
開發者ID:runelangseid,項目名稱:ezpublish,代碼行數:31,代碼來源:ezcache.php

示例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');
//.........這裏部分代碼省略.........
開發者ID:gggeek,項目名稱:ezsnmpd,代碼行數:101,代碼來源:ezsnmpdstatushandler.php


注:本文中的eZCache::fetchByID方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。