当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Cache_Core::test方法代码示例

本文整理汇总了PHP中Zend_Cache_Core::test方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Cache_Core::test方法的具体用法?PHP Zend_Cache_Core::test怎么用?PHP Zend_Cache_Core::test使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Cache_Core的用法示例。


在下文中一共展示了Zend_Cache_Core::test方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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);
 }
开发者ID:PavloKovalov,项目名称:seotoaster,代码行数:14,代码来源:Cache.php

示例2: testTest

 public function testTest()
 {
     $this->rediska->set('test', array('aaa', time(), null));
     $value = $this->cache->test('test');
     $this->assertTrue(is_integer($value));
     $value = $this->cache->test('test2');
     $this->assertFalse($value);
 }
开发者ID:utachkin,项目名称:Rediska,代码行数:8,代码来源:Cache.php

示例3: testTest

 public function testTest()
 {
     $this->cache->save('aaa', 'test');
     $value = $this->cache->test('test');
     $this->assertTrue(is_integer($value));
     $value = $this->cache->test('test2');
     $this->assertFalse($value);
 }
开发者ID:r-kovalenko,项目名称:Rediska,代码行数:8,代码来源:CacheTest.php

示例4: _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;
 }
开发者ID:henvic,项目名称:MediaLab,代码行数:16,代码来源:Application.php

示例5: 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;
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:23,代码来源:Abstract.php

示例6: exists

 /**
  * Checks the availability of a given tag
  *
  * @param string $key
  * @return boolean
  */
 public function exists($key)
 {
     if (null !== $this->cacheAdapter) {
         $prefixedKey = $this->prefixKey($key);
         return $this->cacheAdapter->test($prefixedKey) !== false;
     }
     return false;
 }
开发者ID:cipherpols,项目名称:cze,代码行数:14,代码来源:CacheManager.php

示例7: _loadConfig

 /**
  * @param string $file
  * @param bool $fromDefault
  * @return Zend_Config
  * @author Se#
  * @version 0.0.1
  */
 protected function _loadConfig($file, $fromDefault = false)
 {
     // define is default config need
     $default = $fromDefault ? false : $this->_defaultConfig();
     $suffix = strtolower(pathinfo($file, PATHINFO_EXTENSION));
     if ($this->_configCache === null || $suffix == 'php' || $suffix == 'inc') {
         //No need for caching those
         return $default ? $this->_mergeConfigs($default, parent::_loadConfig($file)) : parent::_loadConfig($file);
     }
     $configMTime = filemtime($file);
     $cacheId = $this->_cacheId($file);
     $cacheLastMTime = $this->_configCache->test($cacheId);
     if ($cacheLastMTime !== false && $configMTime < $cacheLastMTime) {
         //Valid cache?
         return $this->_configCache->load($cacheId, true);
     } else {
         $config = parent::_loadConfig($file);
         $this->_configCache->save($config, $cacheId, array(), null);
         return $default ? $this->_mergeConfigs($default, $config) : $config;
     }
 }
开发者ID:nurikk,项目名称:EvilRocketFramework,代码行数:28,代码来源:Application.php

示例8: _getOptions

 /**
  * Get options
  *
  * @return array
  */
 private function _getOptions()
 {
     if (!extension_loaded('apc')) {
         return $this->_makeOptions();
     }
     //@todo GET SESSION/CACHE/LOAD Config
     include_once 'ZLayer/Cache.php';
     include_once 'Zend/Cache.php';
     include_once 'Zend/Cache/Core.php';
     include_once 'Zend/Cache/Backend/Apc.php';
     $configCache = new Zend_Cache_Core(array('automatic_serialization' => true));
     $backend = new Zend_Cache_Backend_Apc();
     $configCache->setBackend($backend);
     //$configMTime = filemtime($file);
     $cacheId = ZLayer_Cache::id("application");
     $configCache->remove($cacheId);
     if ($configCache->test($cacheId) !== false) {
         return $configCache->load($cacheId, true);
     } else {
         $array = $this->_makeOptions();
         $configCache->save($array, $cacheId, array(), null);
         return $array;
     }
 }
开发者ID:BGCX261,项目名称:zlayer-svn-to-git,代码行数:29,代码来源:Application.php

示例9: login

 /**
  * login to Tine 2.0 installation 
  * 
  * @param string $loginname
  * @param string $password
  * @return array decoded JSON responce
  * @throws Zend_Service_Exception
  */
 public function login($loginname, $password)
 {
     $this->setSkipSystemLookup(true);
     $response = $this->call('Tinebase.login', array('username' => $loginname, 'password' => $password));
     if ($response['success'] !== true) {
         throw new Zend_Service_Exception($response['errorMessage']);
     }
     $this->_jsonKey = $response['jsonKey'];
     $this->_account = $response['account'];
     $this->getHttpClient()->setHeaders('X-Tine20-JsonKey', $this->_jsonKey);
     if ($this->_cache instanceof Zend_Cache_Core) {
         if ($this->_cache->test('tine20PrivateSMD')) {
             $smd = $this->_cache->load('tine20PrivateSMD');
             $this->getIntrospector()->setSMD($smd);
         } else {
             $smd = $this->getIntrospector()->fetchSMD();
             $this->_cache->save($smd, 'tine20PrivateSMD');
         }
     } else {
         $this->getIntrospector()->fetchSMD();
     }
     $this->setSkipSystemLookup(false);
     return $response;
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:32,代码来源:Tine20.php

示例10: doContains

 /**
  * Test if an entry exists in the cache.
  *
  * @param string $id cache id The cache id of the entry to check for.
  *
  * @return boolean TRUE if a cache entry exists for the given cache id, FALSE otherwise.
  */
 protected function doContains($id)
 {
     return $this->cache->test($this->prefix . md5($id));
 }
开发者ID:GerDner,项目名称:luck-docker,代码行数:11,代码来源:Cache.php

示例11: assertKeys

 protected function assertKeys(Zend_Cache_Core $cache, array $keys)
 {
     foreach ($keys as $key) {
         $this->assertTrue($cache->test($key) > 0);
     }
 }
开发者ID:redema,项目名称:silverstripe-zcba,代码行数:6,代码来源:ZendCacheBackendMemoryTest.php

示例12: _doContains

 /**
  *
  * @param string $id
  * @return boolean
  */
 protected function _doContains($id)
 {
     return (bool) $this->_zendCache->test($id);
 }
开发者ID:sveneisenschmidt,项目名称:phoursquare,代码行数:9,代码来源:ZendCacheWrapper.php

示例13: test

 /**
  * {@inheritdoc}
  */
 public function test($identifier)
 {
     return $this->_frontend->test($this->_unifyId($identifier));
 }
开发者ID:IlyaGluschenko,项目名称:test001,代码行数:7,代码来源:Zend.php

示例14: _check

 /**
  * @return Controlador
  */
 private function _check()
 {
     if (is_null($this->usuario) && !strstr($this->_view, 'captcha.php') && !strstr($this->_view, 'modelos/login/login.php') && !strstr($this->_view, 'recuperar_senha_usuario.php') && !strstr($this->_view, 'webservices/') && !strstr($this->_view, 'logoff.php') && !strstr($this->_view, 'modelos/prazos/verificar_prazos_pendentes.php') && !strstr($this->_view, 'modelos/usuarios/recuperar_senha_usuario.php')) {
         $this->_view = 'identificacao.php';
     }
     if (!is_null($this->usuario)) {
         if (is_null($this->usuario->ID_UNIDADE) && $this->_view != 'logoff.php') {
             if (count($this->unidades) > 1) {
                 $this->_view = 'usuario_selecionar_unidade.php';
             } else {
                 if (count($this->unidades) == 1) {
                     $this->usuario->DIRETORIA = current($this->unidades)->NOME;
                     $this->usuario->ID_UNIDADE = current($this->unidades)->ID;
                     $this->usuario->ID_UNIDADE_ORIGINAL = current($this->unidades)->ID;
                     Zend_Auth::getInstance()->getStorage()->write($this->usuario);
                     $this->_prepareAcl();
                 } else {
                     $this->_view = 'usuario_sem_unidade_vinculada.php';
                 }
             }
         }
         if ($this->_view == '' || $this->_view == '/' || $this->_view == 'identificacao.php') {
             $this->_view = 'sistemas.php';
         }
         /*
          * Pegar o id do recurso que o usuário está tentando acessar
          * isso não deve ser feito no caso do recurso ser login ou logoff
          */
         if (substr_count($this->_view, '/') == 0 && array_search($this->_view, $this->_excessoes) === false) {
             $name_recurso = str_replace('.', '_', $this->_view);
             if (!$this->cache->test('recurso_' . $name_recurso)) {
                 $this->recurso = DaoRecurso::getRecursoByUrl($this->_view);
                 if (isset($this->recurso->id)) {
                     $this->cache->save($this->recurso, 'recurso_' . $name_recurso, array('recurso_' . $this->recurso->id, 'paginas'));
                 } else {
                     $this->recurso = null;
                 }
             } else {
                 $this->recurso = $this->cache->load('recurso_' . $name_recurso);
             }
             /*
              * Verificacao de ACL ocorre abaixo
              * mas não deve ocorrer a menos que o usuário esteja requisitando
              * um recurso contido na pasta interfaces
              * Não existe verificacao de Acl para a pasta modelos/
              */
             if (isset($this->recurso->id)) {
                 if ($this->acl->has($this->recurso->id)) {
                     if (!$this->acl->isAllowed($this->usuario->ID, $this->recurso)) {
                         $this->_view = 'denied.php';
                     } else {
                         // nao recusou o acl, montar os submenus do recurso
                         $this->botoes = Util::getMenus($this->usuario, $this->recurso, $this->acl);
                     }
                 } else {
                     // TODO: Aqui negará novamente, pois se o recurso não existe no acl
                     // deve ser negado por segurança
                     $this->_view = 'denied.php';
                 }
             } else {
                 $this->_view = 'denied.php';
             }
         }
     }
     return $this;
 }
开发者ID:roquebrasilia,项目名称:sgdoc-codigo,代码行数:69,代码来源:Controlador.php

示例15: test

 /**
  * Test if a cache is available for the given id 
  *
  * @param string $id cache id
  * @return boolean true is a cache is available, false else
  */
 public function test($id)
 {
     $lastModified = parent::test($id);
     if ($lastModified) {
         if ($lastModified > $this->_masterFile_mtime) {
             return $lastModified;
         }
     }
     return false;
 }
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:16,代码来源:File.php


注:本文中的Zend_Cache_Core::test方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。