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


PHP Zend_Cache_Backend::__construct方法代碼示例

本文整理匯總了PHP中Zend_Cache_Backend::__construct方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Cache_Backend::__construct方法的具體用法?PHP Zend_Cache_Backend::__construct怎麽用?PHP Zend_Cache_Backend::__construct使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_Cache_Backend的用法示例。


在下文中一共展示了Zend_Cache_Backend::__construct方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __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

示例2: __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

示例3: __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

示例4: __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

示例5: __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

示例6: __construct

 /**
  * Constructor
  *
  * @param array $options associative array of options
  * @throws Zend_Cache_Exception
  * @return void
  */
 public function __construct(array $options = array())
 {
     if (!extension_loaded('memcached')) {
         Zend_Cache::throwException('The memcached extension must be loaded for using this backend !');
     }
     parent::__construct($options);
     if (isset($this->_options['servers'])) {
         $value = $this->_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);
     }
     if (array_key_exists('persistent', $this->_options) && is_string($this->_options['persistent'])) {
         $this->_persistent_id = $this->createPersistentKey($this->_options['persistent'], $this->_options);
     }
     /*
      * disabled the persistent connection for now, because it leads to unexpected results in
      * hits & misses of the cache
      */
     $this->_memcached = new Memcached();
     //$this->_persistent_id);
     $this->_memcached->setOption(Memcached::OPT_DISTRIBUTION, Memcached::DISTRIBUTION_CONSISTENT);
     $this->_memcached->setOption(Memcached::OPT_LIBKETAMA_COMPATIBLE, true);
     /**
      * Use the igbinary serialization protocol if compiled in pecl memcached module
      */
     if (isset($this->_options['json']) && $this->_options['json'] === true && $this->_memcached->getOption(Memcached::HAVE_JSON)) {
         $this->_memcached->setOption(Memcached::OPT_SERIALIZER, Memcached::SERIALIZER_JSON);
     } else {
         if (isset($this->_options['igbinary']) && $this->_options['igbinary'] === true && $this->_memcached->getOption(Memcached::HAVE_IGBINARY)) {
             $this->_memcached->setOption(Memcached::OPT_SERIALIZER, Memcached::SERIALIZER_IGBINARY);
         }
     }
     if (isset($this->_options['prefix']) && $this->_options['prefix'] != '') {
         $this->_memcached->setOption(Memcached::OPT_PREFIX_KEY, $this->_options['prefix']);
     }
     if (isset($this->_options['compression']) && is_bool($this->_options['compression'])) {
         $this->_memcached->setOption(Memcached::OPT_COMPRESSION, $this->_options['compression']);
     }
     /**
      * When using persistent connections, do not re-add the servers and options
      */
     if (!count($this->_memcached->getServerList())) {
         // check servers array for options that are set
         foreach ($this->_options['servers'] as &$server) {
             if (!array_key_exists('port', $server)) {
                 $server['port'] = self::DEFAULT_PORT;
             }
             if (!array_key_exists('weight', $server)) {
                 $server['weight'] = self::DEFAULT_WEIGHT;
             }
             $this->_memcached->addServer($server['host'], $server['port'], $server['weight']);
         }
         //$this->_memcached->addServers($this->_options['servers']);
     }
 }
開發者ID:nstapelbroek,項目名稱:Glitch_Lib,代碼行數:66,代碼來源:Memcached.php

示例7: __construct

 /**
  * Contruct Zend_Cache Redis backend
  * 
  * @param array $options Options
  * 
  * servers        - Array of servers: array(
  *                                        array('host' => '127.0.0.1', 'port' => 6379, 'weight' => 1, 'password' => '123'),
  *                                        array('host' => '127.0.0.1', 'port' => 6380, 'weight' => 2)
  *                                    )
  * serializer     - Callback function for serialization.
  *                  You may use PHP extensions like igbinary (http://opensource.dynamoid.com/)
  *                  or you personal function.
  *                  For default php function serialize.             
  * unserializer   - Unserialize callback.
  * keyDistributor - Algorithm of keys distribution on redis servers.
  *                  For default 'consistentHashing' which implement
  *                  consistent hashing algorithm (http://weblogs.java.net/blog/tomwhite/archive/2007/11/consistent_hash.html)
  *                  You may use basic 'crc32' (crc32(key) % servers_count) algorithm
  *                  or you personal implementation (option value - name of class
  *                  which implements Rediska_KeyDistributor_Interface).
  * 
  */
 public function __construct(array $options = array())
 {
     parent::__construct($options);
     if (isset($options['namespace'])) {
         Zend_Cache::throwException('Namespace must definded in front end options (cache_id_prefix)');
     }
     $this->_rediska = new Rediska($options);
 }
開發者ID:utachkin,項目名稱:Rediska,代碼行數:30,代碼來源:Redis.php

示例8: __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

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

示例10: __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,代碼來源:

示例11: __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

示例12: __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

示例13: __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

示例14: __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

示例15: __construct

 /**
  * Constructor
  *
  * @param array $options associative array of options
  */
 public function __construct($options = array())
 {
     parent::__construct($options);
     if (empty($this->_options['adapter_callback'])) {
         if (!$this->_options['adapter'] instanceof Zend_Db_Adapter_Abstract) {
             Zend_Cache::throwException('Option "adapter" should be declared and extend Zend_Db_Adapter_Abstract!');
         }
     }
     if (empty($this->_options['data_table']) || empty($this->_options['tags_table'])) {
         Zend_Cache::throwException('Options "data_table" and "tags_table" should be declared!');
     }
 }
開發者ID:relue,項目名稱:magento2,代碼行數:17,代碼來源:Database.php


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