本文整理汇总了PHP中Zend_Cache_Backend类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Cache_Backend类的具体用法?PHP Zend_Cache_Backend怎么用?PHP Zend_Cache_Backend使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_Cache_Backend类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
*
* @param array $options associative array of options
*/
public function __construct($options = array())
{
if (!extension_loaded('memcache')) {
Zend_Cache::throwException('The memcache extension must be loaded for using this backend !');
}
parent::__construct($options);
if (isset($options['servers'])) {
$value = $options['servers'];
if (isset($value['host'])) {
// in this case, $value seems to be a simple associative array (one server only)
$value = array(0 => $value);
// let's transform it into a classical array of associative arrays
}
$this->setOption('servers', $value);
}
$this->_memcache = new Memcache();
foreach ($this->_options['servers'] as $server) {
if (!array_key_exists('persistent', $server)) {
$server['persistent'] = Zend_Cache_Backend_Memcached::DEFAULT_PERSISTENT;
}
if (!array_key_exists('port', $server)) {
$server['port'] = Zend_Cache_Backend_Memcached::DEFAULT_PORT;
}
$this->_memcache->addServer($server['host'], $server['port'], $server['persistent']);
}
}
开发者ID:jorgenils,项目名称:zend-framework,代码行数:31,代码来源:Memcached.php
示例2: __construct
/**
* Constructor
*
* @param array $options associative array of options
* @throws Zend_Cache_Exception
* @return void
*/
public function __construct($options = array())
{
if ($options['backend'] instanceof Zend_Cache_Backend_Interface || $options['backend'] instanceof Tid_Zend_Cache_Backend_Abstract) {
$this->_backend = $options['backend'];
} else {
Zend_Cache::throwException('The backend option is not correctly set!');
}
$this->_id = '__' . get_class($this) . '__';
parent::__construct($options);
}
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:17,代码来源:TagsEmu.php
示例3: __construct
/**
* Constructor
*
* @param array $options associative array of options
* @throws Zend_Cache_Exception
* @return void
*/
public function __construct($options = array())
{
parent::__construct($options);
if (is_array($options['backend'])) {
$backendClass = $options['backend']['class'];
$this->_backend = new $backendClass($options['backend']['options']);
} else {
if ($options['backend'] instanceof Zend_Cache_Backend_Interface) {
$this->_backend = $options['backend'];
} else {
Zend_Cache::throwException('The backend option is not correctly set!');
}
}
if (!is_array($options['table'])) {
Zend_Cache::throwException('The table option is not correctly set!');
}
}
开发者ID:BGCX261,项目名称:zoocms-svn-to-git,代码行数:24,代码来源:Tags.php
示例4: __construct
/**
* Constructor
*
* @param array $options Associative array of options
* @throws Zend_Cache_Exception
* @return void
*/
public function __construct(array $options = array())
{
parent::__construct($options);
if ($this->_options['slow_backend'] === null) {
Zend_Cache::throwException('slow_backend option has to set');
} elseif ($this->_options['slow_backend'] instanceof Zend_Cache_Backend_ExtendedInterface) {
$this->_slowBackend = $this->_options['slow_backend'];
} else {
$this->_slowBackend = Zend_Cache::_makeBackend($this->_options['slow_backend'], $this->_options['slow_backend_options'], $this->_options['slow_backend_custom_naming'], $this->_options['slow_backend_autoload']);
if (!in_array('Zend_Cache_Backend_ExtendedInterface', class_implements($this->_slowBackend))) {
Zend_Cache::throwException('slow_backend must implement the Zend_Cache_Backend_ExtendedInterface interface');
}
}
if ($this->_options['fast_backend'] === null) {
Zend_Cache::throwException('fast_backend option has to set');
} elseif ($this->_options['fast_backend'] instanceof Zend_Cache_Backend_ExtendedInterface) {
$this->_fastBackend = $this->_options['fast_backend'];
} else {
$this->_fastBackend = Zend_Cache::_makeBackend($this->_options['fast_backend'], $this->_options['fast_backend_options'], $this->_options['fast_backend_custom_naming'], $this->_options['fast_backend_autoload']);
if (!in_array('Zend_Cache_Backend_ExtendedInterface', class_implements($this->_fastBackend))) {
Zend_Cache::throwException('fast_backend must implement the Zend_Cache_Backend_ExtendedInterface interface');
}
}
$this->_slowBackend->setDirectives($this->_directives);
$this->_fastBackend->setDirectives($this->_directives);
}
开发者ID:netvlies,项目名称:zf,代码行数:33,代码来源:TwoLevels.php
示例5: __construct
/**
* Constructor
*
* @param array $options associative array of options
* @throws \Zend_Cache_Exception
*/
public function __construct(array $options = [])
{
if (!extension_loaded('eaccelerator')) {
\Zend_Cache::throwException('The eaccelerator extension must be loaded for using this backend !');
}
parent::__construct($options);
}
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:13,代码来源:Eaccelerator.php
示例6: __construct
/**
* Constructor
*
* @param array $options associative array of options
* @throws Zend_Cache_Exception
* @return void
*/
public function __construct(array $options = [])
{
if (!extension_loaded('redis')) {
Zend_Cache::throwException('The redis extension must be loaded for using this backend !');
}
parent::__construct($options);
$this->_redis = new Redis();
foreach ($this->_options['servers'] as $server) {
if (!array_key_exists('port', $server)) {
$server['port'] = self::DEFAULT_PORT;
}
if (!array_key_exists('host', $server)) {
$server['host'] = self::DEFAULT_HOST;
}
if (!array_key_exists('persistent', $server)) {
$server['persistent'] = self::DEFAULT_PERSISTENT;
}
if (!array_key_exists('dbindex', $server)) {
$server['dbindex'] = self::DEFAULT_DBINDEX;
}
if ($server['persistent']) {
$result = $this->_redis->pconnect($server['host'], $server['port']);
} else {
$result = $this->_redis->connect($server['host'], $server['port']);
}
if ($result) {
$this->_redis->select($server['dbindex']);
} else {
$this->_redis = null;
}
}
}
开发者ID:web-monster,项目名称:dklabcache,代码行数:39,代码来源:Redis.php
示例7: Clean
/**
* Чистит кеши
*
* @param int $cMode Режим очистки кеша
* @param array $aTags Список тегов, актуально для режима Zend_Cache::CLEANING_MODE_MATCHING_TAG
* @return bool
*/
public function Clean($cMode = Zend_Cache::CLEANING_MODE_ALL, $aTags = array())
{
if (!$this->bUseCache) {
return false;
}
return $this->oBackendCache->clean($cMode, $aTags);
}
开发者ID:lunavod,项目名称:bunker_stable,代码行数:14,代码来源:Cache.class.php
示例8: __construct
/**
* Constructor
*
* @param array $options associative array of options
* @throws Zend_Cache_Exception
* @return void
*/
public function __construct(array $options = array())
{
if (!function_exists('zend_shm_cache_store')) {
Zend_Cache::throwException('Glitch_Cache_Backend_ZendShMem backend has to be used within Zend Server / Zend Platform environment.');
}
parent::__construct($options);
}
开发者ID:nstapelbroek,项目名称:Glitch_Lib,代码行数:14,代码来源:ZendShMem.php
示例9: __construct
/**
* Constructor
*
* @param array $options associative array of options
* @throws Zend_Cache_Exception
* @return void
*/
public function __construct(array $options = array())
{
if (!extension_loaded('xcache')) {
Zend_Cache::throwException('The xcache extension must be loaded for using this backend !');
}
parent::__construct($options);
}
开发者ID:namgiangle90,项目名称:tokyobaito,代码行数:14,代码来源:Xcache.php
示例10: __construct
/**
* Constructor
*
* @param array $options associative array of options
* @throws Zend_Cache_Exception
* @return void
*/
public function __construct(array $options = array())
{
if (!extension_loaded('redis')) {
Zend_Cache::throwException('The redis extension must be loaded for using this backend !');
}
$this->_redis = new Redis();
parent::__construct($options);
}
开发者ID:chukhanhvan,项目名称:Zend_Cache_Backend_Redis,代码行数:15,代码来源:Redis.php
示例11: setOption
/**
* Interceptor child method to handle the case where a Model or
* Database object is being set since it's not supported by the
* standard backend interface
*
* @param string $name
* @param mixed $value
* @return void
*/
public function setOption($name, $value)
{
if ($name == 'db_object') {
$this->setDbObject($value);
} else {
parent::setOption($name, $value);
}
}
开发者ID:padraic,项目名称:zfcache,代码行数:17,代码来源:Database.php
示例12: getOption
/**
* Retrieve any option via interception of the parent's statically held
* options including the local option for a tag cache.
*
* @param string $name
* @return mixed
*/
public function getOption($name)
{
if ($name == 'tag_cache') {
return $this->getInnerCache();
} else {
return parent::getOption($name);
}
}
开发者ID:sanmas,项目名称:ExtJs-FileExplorer,代码行数:15,代码来源:Static.php
示例13: setOption
/**
* Interceptor child method to handle the case where an Inner
* Cache object is being set since it's not supported by the
* standard backend interface
*
* @param string $name
* @param mixed $value
* @return void
*/
public function setOption($name, $value)
{
if ($name == 'tag_cache') {
$this->setInnerCache($value);
} else {
parent::setOption($name, $value);
}
}
开发者ID:padraic,项目名称:zfcache,代码行数:17,代码来源:Static.php
示例14: getOption
/**
* Retrieve any option via interception of the parent's statically held
* options including the local option for a tag cache.
*
* @param string $name
* @return mixed
*/
public function getOption($name)
{
$name = strtolower($name);
if ($name == 'tag_cache') {
return $this->getInnerCache();
}
return parent::getOption($name);
}
开发者ID:GerDner,项目名称:luck-docker,代码行数:15,代码来源:Static.php
示例15: testCleanType
public function testCleanType()
{
$this->_model->allowUse('single_tag');
$this->_model->allowUse('multiple_tags');
$this->_cacheFrontend->expects($this->at(0))->method('clean')->with(Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, array('TAG_ONE', 'TAG_TWO'));
$this->_cacheFrontend->expects($this->at(1))->method('load')->with(strtoupper(Mage_Core_Model_Cache::INVALIDATED_TYPES))->will($this->returnValue(serialize(array('single_tag' => 1, 'multiple_tags' => 1))));
$this->_cacheFrontend->expects($this->at(2))->method('save')->with(serialize(array('single_tag' => 1)), strtoupper(Mage_Core_Model_Cache::INVALIDATED_TYPES));
$this->_model->cleanType('multiple_tags');
}
开发者ID:nemphys,项目名称:magento2,代码行数:9,代码来源:CacheTest.php
示例16: __construct
public function __construct(array $options = array())
{
if (isset($options['cache_id_prefix'])) {
throw new Kwf_Exception("Unsupported optoin for Apcu backend: cache_id_prefix");
}
if (!extension_loaded('apcu')) {
Zend_Cache::throwException('The apcu extension must be loaded for using this backend !');
}
parent::__construct($options);
}
开发者ID:koala-framework,项目名称:koala-framework,代码行数:10,代码来源:Apcu.php
示例17: __construct
/**
* @param array $options
*/
public function __construct(array $options = array())
{
if (!extension_loaded('mongo') || !version_compare(\Mongo::VERSION, '1.2.11', '>=')) {
\Zend_Cache::throwException("At least 1.2.11 version of 'mongo' extension is required for using MongoDb cache backend");
}
if (empty($options['db'])) {
\Zend_Cache::throwException("'db' option is not specified");
}
parent::__construct($options);
}
开发者ID:,项目名称:,代码行数:13,代码来源:
示例18: __construct
/**
* Constructor
*
* @param array $options Associative array of options
* @throws Zend_cache_Exception
* @return void
*/
public function __construct(array $options = array())
{
parent::__construct($options);
if (is_null($this->_options['cache_db_complete_path'])) {
Zend_Cache::throwException('cache_db_complete_path option has to set');
}
if (!extension_loaded('sqlite')) {
Zend_Cache::throwException("Cannot use SQLite storage because the 'sqlite' extension is not loaded in the current PHP environment");
}
$this->_getConnection();
}
开发者ID:padraic,项目名称:zfcache,代码行数:18,代码来源:Sqlite.php
示例19: __construct
/**
* Constructor
*
* @param array $options associative array of options
* @throws Zend_Cache_Exception
* @return void
*/
public function __construct(array $options = array())
{
if (!empty($options['socket'])) {
$options['connmode'] = self::CONN_SOCKET;
}
if (!extension_loaded('redis')) {
Zend_Cache::throwException('The redis extension must be loaded for using this backend !');
}
$this->_redis = new Redis();
parent::__construct($options);
}
开发者ID:wthielen,项目名称:zf1e,代码行数:18,代码来源:Redis.php
示例20: __construct
/**
* Constructor
*
* @param array $options associative array of options
*/
public function __construct($options = array())
{
if (!isset($options['cacheDBCompletePath'])) {
Zend_Cache::throwException('cacheDBCompletePath option has to set');
}
$this->_db = @sqlite_open($options['cacheDBCompletePath']);
if (!$this->_db) {
Zend_Cache::throwException("Impossible to open " . $options['cacheDBCompletePath'] . " cache DB file");
}
parent::__construct($options);
}
开发者ID:jorgenils,项目名称:zend-framework,代码行数:16,代码来源:Sqlite.php
注:本文中的Zend_Cache_Backend类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论