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


PHP Zend_Cache_Core::setBackend方法代码示例

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


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

示例1: _getSlowCache

 public static function _getSlowCache()
 {
     static $ret;
     if (!isset($ret)) {
         $ret = new Zend_Cache_Core(array('lifetime' => null, 'automatic_serialization' => true, 'automatic_cleaning_factor' => 0, 'write_control' => false));
         $ret->setBackend(new Zend_Cache_Backend_File(array('cache_dir' => 'cache/assets', 'cache_file_perm' => 0666, 'hashed_directory_perm' => 0777, 'hashed_directory_level' => 2)));
     }
     return $ret;
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:9,代码来源:Cache.php

示例2: _getSecondLevelCache

 private function _getSecondLevelCache()
 {
     if (!$this->_secondLevelCache) {
         $c = new Zend_Cache_Core(array('lifetime' => null, 'write_control' => false, 'automatic_cleaning_factor' => 0, 'automatic_serialization' => true));
         $c->setBackend(new Kwf_Cache_Backend_File(array('cache_dir' => 'cache/mediameta', 'hashed_directory_level' => 2)));
         $this->_secondLevelCache = $c;
     }
     return $this->_secondLevelCache;
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:9,代码来源:MemoryCache.php

示例3: _getCache

 private static function _getCache()
 {
     static $cache;
     if (!isset($cache)) {
         $cache = new Zend_Cache_Core(array('lifetime' => null, 'write_control' => false, 'automatic_cleaning_factor' => 0, 'automatic_serialization' => true));
         $cache->setBackend(new Kwf_Cache_Backend_File(array('cache_dir' => 'cache/commonjs', 'hashed_directory_level' => 2)));
     }
     return $cache;
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:9,代码来源:Parser.php

示例4: getCache

 /**
  * Returns a caching instance.
  *
  * @return Zend_Cache_Core
  */
 public function getCache()
 {
     if (null === $this->_cache) {
         $options = $this->getConfig()->cache->frontend->toArray();
         $options['automatic_serialization'] = TRUE;
         if (!isset($options['lifetime']) || (int) $options['lifetime'] < 1) {
             $options['lifetime'] = NULL;
         }
         $this->_cache = new Erfurt_Cache_Frontend_ObjectCache($options);
         $this->_cache->setBackend($this->_getCacheBackend());
     }
     return $this->_cache;
 }
开发者ID:FTeichmann,项目名称:Erfurt,代码行数:18,代码来源:App.php

示例5: setCache

 public function setCache($cache)
 {
     if ($cache instanceof Zend_Cache_Core) {
         $this->_cache = $cache;
     } else {
         if ($cache instanceof Zend_Cache_Backend_Interface) {
             $this->_cache = new Zend_Cache_Core(array('cache_id_prefix' => get_class($this)));
             $this->_cache->setBackend($cache);
         } else {
             throw new Engine_Package_Manager_Exception('Invalid argument');
         }
     }
     return $this;
 }
开发者ID:robeendey,项目名称:ce,代码行数:14,代码来源:Manager.php

示例6: _defaultConfigCache

 /**
  * @description create default cache core
  * @param string|array $env
  * @return Zend_Cache_Core
  * @author Se#
  * @version 0.0.2
  */
 protected function _defaultConfigCache($env)
 {
     $env = is_array($env) ? $env : array($env);
     $configCache = null;
     //We will cache only in defined environment(s)
     if (in_array(APPLICATION_ENV, $env)) {
         list($class, $file) = $this->_defineCacheClassAndFile();
         // Bubble-defining
         if (is_file($file)) {
             require_once 'Zend/Cache.php';
             require_once 'Zend/Cache/Core.php';
             require_once $file;
             $configCache = new Zend_Cache_Core(array('automatic_serialization' => true));
             $backend = new $class();
             $configCache->setBackend($backend);
         }
     }
     return $configCache;
 }
开发者ID:nurikk,项目名称:EvilRocketFramework,代码行数:26,代码来源:Application.php

示例7: setUp

 public function setUp()
 {
     $zendCacheCore = new \Zend_Cache_Core();
     $zendCacheCore->setBackend(new \Zend_Cache_Backend_BlackHole());
     $frontendCache = $this->getMockForAbstractClass('Magento\\Framework\\Cache\\FrontendInterface', [], '', false);
     $frontendCache->expects($this->any())->method('getLowLevelFrontend')->will($this->returnValue($zendCacheCore));
     $cache = $this->getMock('Magento\\Framework\\App\\CacheInterface');
     $cache->expects($this->any())->method('getFrontend')->will($this->returnValue($frontendCache));
     $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $localeResolver = $this->getMock('\\Magento\\Framework\\Locale\\ResolverInterface');
     $localeResolver->expects($this->any())->method('getLocale')->willReturn(Resolver::DEFAULT_LOCALE);
     $timezone = $objectManager->getObject('Magento\\Framework\\Stdlib\\DateTime\\Timezone', ['localeResolver' => $localeResolver]);
     $context = $this->getMock('Magento\\Framework\\View\\Element\\Template\\Context', [], [], '', false);
     $context->expects($this->any())->method('getLocaleDate')->will($this->returnValue($timezone));
     $this->attribute = $this->getMockBuilder('\\Magento\\Customer\\Api\\Data\\AttributeMetadataInterface')->getMockForAbstractClass();
     $this->customerMetadata = $this->getMockBuilder('\\Magento\\Customer\\Api\\CustomerMetadataInterface')->getMockForAbstractClass();
     $this->customerMetadata->expects($this->any())->method('getAttributeMetadata')->will($this->returnValue($this->attribute));
     date_default_timezone_set('America/Los_Angeles');
     $this->_block = new \Magento\Customer\Block\Widget\Dob($context, $this->getMock('Magento\\Customer\\Helper\\Address', [], [], '', false), $this->customerMetadata, $this->getMock('Magento\\Framework\\View\\Element\\Html\\Date', [], [], '', false));
 }
开发者ID:tingyeeh,项目名称:magento2,代码行数:20,代码来源:DobTest.php

示例8: setUp

 public function setUp()
 {
     $zendCacheCore = new \Zend_Cache_Core();
     $zendCacheCore->setBackend(new \Zend_Cache_Backend_BlackHole());
     $frontendCache = $this->getMockForAbstractClass('Magento\\Framework\\Cache\\FrontendInterface', array(), '', false);
     $frontendCache->expects($this->any())->method('getLowLevelFrontend')->will($this->returnValue($zendCacheCore));
     $cache = $this->getMock('Magento\\Framework\\App\\CacheInterface');
     $cache->expects($this->any())->method('getFrontend')->will($this->returnValue($frontendCache));
     $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
     $locale = $objectManager->getObject('\\Magento\\Framework\\Locale', array('locale' => \Magento\Framework\Locale\ResolverInterface::DEFAULT_LOCALE));
     $localeResolver = $this->getMock('\\Magento\\Framework\\Locale\\ResolverInterface');
     $localeResolver->expects($this->any())->method('getLocale')->will($this->returnValue($locale));
     $timezone = $objectManager->getObject('\\Magento\\Framework\\Stdlib\\DateTime\\Timezone', array('localeResolver' => $localeResolver));
     $context = $this->getMock('Magento\\Framework\\View\\Element\\Template\\Context', array(), array(), '', false);
     $context->expects($this->any())->method('getLocaleDate')->will($this->returnValue($timezone));
     $this->_attribute = $this->getMock('Magento\\Customer\\Service\\V1\\Data\\Eav\\AttributeMetadata', array(), array(), '', false);
     $this->_metadataService = $this->getMockForAbstractClass('Magento\\Customer\\Service\\V1\\CustomerMetadataServiceInterface', array(), '', false);
     $this->_metadataService->expects($this->any())->method('getCustomerAttributeMetadata')->will($this->returnValue($this->_attribute));
     date_default_timezone_set('America/Los_Angeles');
     $this->_block = new Dob($context, $this->getMock('Magento\\Customer\\Helper\\Address', array(), array(), '', false), $this->_metadataService);
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:21,代码来源:DobTest.php

示例9: _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

示例10: setBackend

 /**
  * Set the backend
  *
  * @param  \Zend_Cache_Backend $backendObject
  * @return void
  */
 public function setBackend(\Zend_Cache_Backend $backendObject)
 {
     $backendObject = $this->_decorateBackend($backendObject);
     parent::setBackend($backendObject);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:11,代码来源:Core.php

示例11: realpath

<?php

define("APPLICATION_PATH", realpath(__DIR__));
define("LIBRARY_PATH", realpath(APPLICATION_PATH . "/../library"));
require __DIR__ . "/configs/Environment.php.dist";
set_include_path(implode(PATH_SEPARATOR, array(EXTERNAL_LIBRARY_PATH, LIBRARY_PATH, get_include_path())));
require EXTERNAL_LIBRARY_PATH . '/Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance()->registerNamespace('Ml_');
$resourceLoader = new Zend_Loader_Autoloader_Resource(array('basePath' => APPLICATION_PATH, 'namespace' => 'Ml'));
$resourceLoader->addResourceType('form', 'forms/', 'Form')->addResourceType('models', 'models/Ml/', 'Model')->addResourceType('resources', 'resources/', 'Resource');
require EXTERNAL_LIBRARY_PATH . '/Zend/Registry.php';
require EXTERNAL_LIBRARY_PATH . '/Zend/Cache/Core.php';
//@todo redo the library/Ml/RouteModule.php the proper way
/** Ml_Application */
require EXTERNAL_LIBRARY_PATH . '/Zend/Application.php';
require LIBRARY_PATH . '/Ml/Application.php';
$sysCache = new Zend_Cache_Core(array('automatic_serialization' => true));
$sysCache->setBackend(new Zend_Cache_Backend_File(array("cache_dir" => CACHE_PATH)));
Zend_Registry::getInstance()->set("sysCache", $sysCache);
// Create application, bootstrap, and run
try {
    $application = new Ml_Application(APPLICATION_ENV, APPLICATION_CONF_FILE, $sysCache, true);
    $application->bootstrap()->run();
} catch (Exception $e) {
    //don't throw it because there's no exception wrapper to treat it
    new Ml_Model_Exception("Exception: " . $e->getMessage(), $e->getCode(), $e);
}
开发者ID:henvic,项目名称:MediaLab,代码行数:27,代码来源:Start.php


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