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


PHP CCache::init方法代码示例

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


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

示例1: getCacheProxy

 /**
  * @return CCache
  */
 protected function getCacheProxy()
 {
     if (is_null($this->_cacheProxy)) {
         $this->_cacheProxy = Yii::createComponent($this->cache);
         $this->_cacheProxy->init();
     }
     return $this->_cacheProxy;
 }
开发者ID:pendalff,项目名称:yii-debug-toolbar,代码行数:11,代码来源:YiiDebugCacheProxy.php

示例2: init

 /**
  * Initializes this application component.
  * This method is required by the {@link IApplicationComponent} interface.
  * It checks the availability of memcache.
  * @throws CException if memcache extension is not loaded or is disabled.
  */
 public function init()
 {
     parent::init();
     if (!function_exists('xcache_isset')) {
         throw new CException(Yii::t('yii', 'CXCache requires PHP XCache extension to be loaded.'));
     }
 }
开发者ID:hansenmakangiras,项目名称:yiiframework-cms,代码行数:13,代码来源:CXCache.php

示例3: init

 /**
  * Initializes this application component.
  * This method is required by the {@link IApplicationComponent} interface.
  * It checks the availability of APC.
  * @throws CException if APC cache extension is not loaded or is disabled.
  */
 public function init()
 {
     parent::init();
     if (!extension_loaded('apc')) {
         throw new CException(Yii::t('yii', 'CApcCache requires PHP apc extension to be loaded.'));
     }
 }
开发者ID:dev-lav,项目名称:htdocs,代码行数:13,代码来源:CApcCache.php

示例4: init

 /**
  * Initializes this application component.
  * This method is required by the {@link IApplicationComponent} interface.
  * It checks the availability of eAccelerator.
  * @throws CException if eAccelerator extension is not loaded, is disabled or the cache functions are not compiled in.
  */
 public function init()
 {
     parent::init();
     if (!function_exists('eaccelerator_get')) {
         throw new CException(Yii::t('yii', 'CEAcceleratorCache requires PHP eAccelerator extension to be loaded, enabled or compiled with the "--with-eaccelerator-shared-memory" option.'));
     }
 }
开发者ID:alsvader,项目名称:hackbanero,代码行数:13,代码来源:CEAcceleratorCache.php

示例5: init

 /**
  * Initializes this application component.
  * ensureIndex 'key' if $ensureIndex = true
  * Set $ensureIndex to false after first use to increase performance
  *
  * This method is required by the {@link IApplicationComponent} interface.
  * It ensures the existence of the cache DB table.
  * It also removes expired data items from the cache.
  */
 public function init()
 {
     parent::init();
     if ($this->ensureIndex) {
         $this->getCollection()->createIndex(['key' => 1]);
         // create index on "key"
     }
 }
开发者ID:yiicod,项目名称:mongoyii,代码行数:17,代码来源:EMongoCache.php

示例6: init

 /**
  * Initializes this application component.
  * This method is required by the {@link IApplicationComponent} interface.
  * It checks the availability of APC.
  * @throws CException if APC cache extension is not loaded or is disabled.
  */
 public function init()
 {
     parent::init();
     $extension = $this->useApcu ? 'apcu' : 'apc';
     if (!extension_loaded($extension)) {
         throw new CException(Yii::t('yii', "CApcCache requires PHP {extension} extension to be loaded.", array('{extension}' => $extension)));
     }
 }
开发者ID:urichalex,项目名称:CS-Bans,代码行数:14,代码来源:CApcCache.php

示例7: init

 /**
  * Initializes this application component.
  * ensureIndex 'key' if $ensureIndex = true
  * Set $ensureIndex to false after first use to increase performance
  *
  * This method is required by the {@link IApplicationComponent} interface.
  * It ensures the existence of the cache DB table.
  * It also removes expired data items from the cache.
  */
 public function init()
 {
     parent::init();
     $collection = $this->getCollection();
     if ($this->ensureIndex) {
         $collection->ensureIndex(array('key' => 1));
     }
     // create index on "key"
 }
开发者ID:niranjan2m,项目名称:Voyanga,代码行数:18,代码来源:MongoDbCache.php

示例8: init

 /**
  * Initializes this application component.
  * This method is required by the {@link IApplicationComponent} interface.
  * It creates the redis instance and adds redis servers.
  * @throws CException if redis extension is not loaded
  */
 public function init()
 {
     parent::init();
     $servers = $this->getServers();
     if (!count($servers)) {
         $this->_servers[] = $servers = array('host' => '127.0.0.1', 'port' => 6379);
     }
     $this->getRedis();
 }
开发者ID:kl0428,项目名称:urtime,代码行数:15,代码来源:CRedisCache_old.php

示例9: init

 /**
  * Initializes this application component.
  * This method is required by the {@link IApplicationComponent} interface.
  * It checks the availability of WinCache extension and WinCache user cache.
  * @throws CException if WinCache extension is not loaded or user cache is disabled
  */
 public function init()
 {
     parent::init();
     if (!extension_loaded('wincache')) {
         throw new CException(Yii::t('yii', 'CWinCache requires PHP wincache extension to be loaded.'));
     }
     if (!ini_get('wincache.ucenabled')) {
         throw new CException(Yii::t('yii', 'CWinCache user cache is disabled. Please set wincache.ucenabled to On in your php.ini.'));
     }
 }
开发者ID:charlymanja,项目名称:traceper,代码行数:16,代码来源:CWinCache.php

示例10: init

 /**
  * Initializes this application component.
  * This method is required by the {@link IApplicationComponent} interface.
  */
 public function init()
 {
     parent::init();
     if ($this->cachePath === null) {
         $this->cachePath = Yii::app()->getRuntimePath() . DIRECTORY_SEPARATOR . 'cache';
     }
     if (!is_dir($this->cachePath)) {
         mkdir($this->cachePath, 0777, true);
     }
 }
开发者ID:jicheng17,项目名称:yiifamilyblog,代码行数:14,代码来源:CFileCache.php

示例11: init

 /**
  * Initializes this application component.
  * This method is required by the {@link IApplicationComponent} interface.
  * It creates the memcacheSASL instance and adds memcache servers.
  */
 public function init()
 {
     include 'MemcacheSASL.php';
     parent::init();
     $server = $this->getServer();
     $cache = $this->getMemCache();
     if ($server) {
         $cache->addServer($server->host, $server->port);
         $cache->setSaslAuthData($server->username, $server->password);
     }
 }
开发者ID:jingshui1946,项目名称:yii-CMemCacheSASL,代码行数:16,代码来源:CMemCacheSASL.php

示例12: init

 /**
  * Initializes this application component.
  *
  * This method is required by the {@link IApplicationComponent} interface.
  * It ensures the existence of the cache DB table.
  * It also removes expired data items from the cache.
  */
 public function init()
 {
     parent::init();
     $db = $this->getDbConnection();
     $db->setActive(true);
     if ($this->autoCreateCacheTable) {
         $sql = "DELETE FROM {$this->cacheTableName} WHERE expire>0 AND expire<" . time();
         try {
             $db->createCommand($sql)->execute();
         } catch (Exception $e) {
             $this->createCacheTable($db, $this->cacheTableName);
         }
     }
 }
开发者ID:Jride,项目名称:accounting-thaiconnections,代码行数:21,代码来源:CDbCache.php

示例13: init

 /**
  * Initializes this application component.
  * This method is required by the {@link IApplicationComponent} interface.
  * It creates the memcache instance and adds memcache servers.
  * @throws CException if memcache extension is not loaded
  */
 public function init()
 {
     parent::init();
     $servers = $this->getServers();
     $cache = $this->getMemCache();
     if (count($servers)) {
         foreach ($servers as $server) {
             if ($this->useMemcached) {
                 $cache->addServer($server->host, $server->port, $server->weight);
             } else {
                 $cache->addServer($server->host, $server->port, $server->persistent, $server->weight, $server->timeout, $server->status);
             }
         }
     } else {
         $cache->addServer('localhost', 11211);
     }
 }
开发者ID:israelCanul,项目名称:Bonanza_V2,代码行数:23,代码来源:CMemCache.php

示例14: init

 /**
  * Initializes this application component.
  *
  * This method is required by the {@link IApplicationComponent} interface.
  * It ensures the existence of the cache DB table.
  * It also removes expired data items from the cache.
  */
 public function init()
 {
     parent::init();
     $db = $this->getDbConnection();
     $db->setActive(true);
     $sql = "DELETE FROM {$this->cacheTableName} WHERE expire>0 AND expire<" . time();
     try {
         $db->createCommand($sql)->execute();
     } catch (Exception $e) {
         // The cache table does not exist
         if ($this->autoCreateCacheTable) {
             $this->createCacheTable($db, $this->cacheTableName);
         } else {
             throw new CException(Yii::t('yii', 'Cache table "{tableName}" does not exist.', array('{tableName}' => $this->cacheTableName)));
         }
     }
 }
开发者ID:zarethernet,项目名称:yaamp,代码行数:24,代码来源:CDbCache.php

示例15: init

 /**
  * Initializes this application component.
  *
  * This method is required by the {@link IApplicationComponent} interface.
  * It ensures the existence of the cache DB table.
  * It also removes expired data items from the cache.
  */
 public function init()
 {
     parent::init();
     $db = $this->getDbConnection();
     $db->setActive(true);
     if ($this->autoCreateCacheTable) {
         $sql = "DELETE FROM {$this->cacheTableName} WHERE expire>0 AND expire<" . time();
         try {
             $db->createCommand($sql)->execute();
         } catch (Exception $e) {
             try {
                 $this->createCacheTable($db, $this->cacheTableName);
             } catch (Exception $eInner) {
                 throw new CDbException('Cache purge failed: ' . $e->getMessage() . "\n\nAdditionally the following error was encountered while trying to prepare the cache: " . $eInner->getMessage());
             }
         }
     }
 }
开发者ID:Jmainguy,项目名称:multicraft_install,代码行数:25,代码来源:CDbCache.php


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