本文整理汇总了PHP中Zend_Cache_Core::load方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Cache_Core::load方法的具体用法?PHP Zend_Cache_Core::load怎么用?PHP Zend_Cache_Core::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Cache_Core
的用法示例。
在下文中一共展示了Zend_Cache_Core::load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: find
public static function find($search_data, array $overrideSources = null)
{
$sources = array('local', 'def');
if (is_array($overrideSources)) {
$sources = $overrideSources;
}
if (self::$_cache !== null && is_scalar($search_data) && is_numeric($search_data)) {
$cached = self::$_cache->load(__CLASS__ . implode('_', $sources) . $search_data);
if ($cached !== false) {
return $cached;
}
}
$found = array();
foreach ($sources as $source) {
$sourceObject = self::getSource($source);
$founded_temp = self::findInSource($search_data, is_array($search_data) ? self::detectCustomerType($search_data) : '', $sourceObject);
if (count($founded_temp) > 0) {
$found = array_merge($found, $founded_temp);
}
}
if (self::$_cache !== null && is_scalar($search_data) && count($found) == 1 && is_numeric($search_data)) {
self::$_cache->save($found, __CLASS__ . implode('_', $sources) . $search_data);
}
return $found;
}
示例2: load
/**
* Pre event - try load content from cache
*
* @param \Zend_EventManager_EventDescription $event
* @return mixed
*/
public function load(\Zend_EventManager_EventDescription $event)
{
if (false !== ($content = $this->cache->load($this->_getIdentifier($event)))) {
$event->stopPropagation(true);
return $content;
}
}
示例3: cacheOrParserPdfWithFPDI
/**
* Recupera parser do Pdf: faz o parser em tempo real ou recupera do cache
*
* @param string $arqInsert
* @return fpdi_pdf_parser
*/
public function cacheOrParserPdfWithFPDI($pagePdf, $pathArquivoPdf)
{
//try {
//verifica parser do Pdf no cache
$parserPdfCache = $this->cache->load($pagePdf);
$origem = "--->parserPdf vem do cache---";
$this->objMakePdf->current_filename = $pathArquivoPdf;
//recupera do cache
if ($parserPdfCache == false) {
//tento fazer o parser do pdf
$parserPdfCache = $this->objMakePdf->_getPdfParser($pathArquivoPdf);
//salvo o parser do pdf no cache
$this->cache->save($parserPdfCache, $pagePdf);
$origem = "--->parserPdf NAO vem do cache---";
} else {
//grava parser pdf no var do objeto FPDI
$this->objMakePdf->parsers[$pathArquivoPdf] = $parserPdfCache;
}
echo $origem;
$this->setCacheYesOrNo($origem);
$result = true;
//} catch (Exception $e) {
// throw new Exception("There is a problem at PDF parser process");
// $result = false;
// }
return $result;
}
示例4: testClean
/**
* @group all
*/
public function testClean()
{
$this->setKeys();
$reply = $this->cache->clean();
$this->assertTrue($reply);
$reply = $this->cache->load('test_aaa');
$this->assertFalse($reply);
}
示例5: testLoad
public function testLoad()
{
$this->rediska->set('test', array('aaa', time(), null));
$value = $this->cache->load('test');
$this->assertEquals('aaa', $value);
$value = $this->cache->load('test2');
$this->assertFalse($value);
}
示例6: load
/**
* Load data from cache
* @param $cacheKey Unique cache id
* @param string $cachePrefix Cache prefix
* @return null Returns null if nothing found
*/
public function load($cacheKey, $cachePrefix = '')
{
$cacheId = $this->_makeCacheId($cacheKey, $cachePrefix);
if (!$this->_cache->test($cacheId)) {
return null;
}
return $this->_cache->load($cacheId);
}
示例7: __construct
/**
*
* @param string $id A unique name identifying the batch
*/
public function __construct($id, \Zend_Cache_Core $cache)
{
$this->_cacheId = 'batch_' . session_id() . '_' . $id;
$this->_cache = $cache;
$this->_commands = $this->_cache->load($this->_cacheId, true);
if (!$this->_commands) {
$this->_commands = array();
}
}
示例8: alternative
/**
*
*/
public function alternative($alternative_id, Model_Alternative $modelAlternative)
{
$nameCache = 'alternative_' . $alternative_id;
$alternative = $this->cache->load($nameCache);
$origem = "--->alternative vem do cache---";
//recupera do cache
if ($alternative == false) {
$alternative = $modelAlternative->getAlternativeById($alternative_id);
$this->cache->save($alternative, $nameCache);
$origem = "--->alternative NAO vem do cache---";
}
return $alternative;
}
示例9: fazCacheAcl
/**
* metodo chamado em Vtx_Plugin_Permission
*/
public function fazCacheAcl($sysId = 1)
{
if ($sysId == 1) {
$nameCache = 'acl';
} else {
$nameCache = 'acl' . $sysId;
}
$acl = $this->cache->load($nameCache);
if (!$acl) {
$acl = new Model_Acl(true);
$this->cache->save($acl, $nameCache);
}
return $acl;
}
示例10: __construct
/**
* Generates the adapter
*
* @param string|array $data Translation data or filename for this adapter
* @param string|Zend_Locale $locale (optional) Locale/Language to set, identical with Locale
* identifiers see Zend_Locale for more information
* @param array $options (optional) Options for the adaptor
* @throws Zend_Translate_Exception
* @return void
*/
public function __construct($data, $locale = null, array $options = array())
{
if (isset(self::$_cache)) {
$id = 'Zend_Translate_' . $this->toString();
if ($result = self::$_cache->load($id)) {
$this->_translate = unserialize($result);
$this->_options = $this->_translate['_options_'];
unset($this->_translate['_options_']);
return;
}
}
$this->addTranslation($data, $locale, $options);
$this->_automatic = true;
}
示例11: read
/**
* Read session data
*
* @param string $id
*/
public function read($id)
{
// The cache backend might produce some error if the servers are unavailable
// for example.
$oldStartError = Zend_Session_Exception::$sessionStartError;
// Fetch the contents from the cache
$session = $this->_cache->load($this->_prefix . $id);
if (!$session) {
$session = '';
}
// Restore the previous error (if any)
Zend_Session_Exception::$sessionStartError = $oldStartError;
return $session;
}
示例12: getHistorical
public function getHistorical($name, $date)
{
$sufix = str_replace('-', '', substr($date, 0, 10));
$cached = $this->_cache->load(__CLASS__ . $name . $sufix);
if ($cached !== false) {
return $cached;
} else {
$row = $this->fetchRow(array('key = ?' => $name, 'created_at::date <= \'' . $date . '\'::date'), 'id DESC');
if ($row !== null) {
$this->_cache->save($row->value, __CLASS__ . $name . $sufix);
return $row->value;
} else {
return $this->get($name);
}
}
}
示例13: _loadConfig
protected function _loadConfig($file)
{
if ($this->_useCache == false) {
return parent::_loadConfig($file);
}
$configMTime = filemtime($file);
$cacheId = "application_conf_" . md5($file . $this->getEnvironment());
$cacheLastMTime = $this->_configCache->test($cacheId);
//Valid cache?
if ($cacheLastMTime !== false && $configMTime <= $cacheLastMTime) {
return $this->_configCache->load($cacheId, true);
}
$config = parent::_loadConfig($file);
$this->_configCache->save($config, $cacheId, array(), null);
return $config;
}
示例14: getCache
/**
* Get cache object
*
* @param string $id
* @return Zend_Cache_Core|mixed
*/
public function getCache($id = null)
{
if ($id !== null) {
return $this->_cache->load($id);
}
return $this->_cache;
}
示例15: get
/**
* get by id
* - results are cached
*
* @param string $_id the id of the peer
* @return Voipmanager_Model_Snom_Location
*/
public function get($_id)
{
$id = Tinebase_Record_Abstract::convertId($_id, $this->_modelName);
if ($this->_cacheIdPrefix && $this->_cache) {
$cacheId = $this->_cacheIdPrefix . $id;
if ($this->_cache->test($id)) {
$result = $this->_cache->load($id);
} else {
$result = $this->_backend->get($id);
$this->_cache->save($result, $cacheId, array($this->_cacheIdPrefix), 5);
}
} else {
$result = $this->_backend->get($id);
}
return $result;
}