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


PHP JCache::setCaching方法代碼示例

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


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

示例1: __construct

 public function __construct($groupName, $lifeTime = self::DEFAULT_LIFETIME)
 {
     $this->lifeTime = $lifeTime;
     $this->cache =& JFactory::getCache($groupName, 'output');
     $this->cache->setCaching(true);
     $this->cache->setLifeTime($this->lifeTime);
 }
開發者ID:laiello,項目名稱:senluonirvana,代碼行數:7,代碼來源:joomlaCacheDriver.class.php

示例2: __construct

 public function __construct($groupName, $lifeTime = self::DEFAULT_LIFETIME)
 {
     $this->lifeTime = $lifeTime;
     $this->cache = JFactory::getCache($groupName, 'output');
     $conf = JFactory::getConfig();
     $this->cache->setCaching(true);
     $this->cache->setLifeTime($conf->get('cachetime', $lifeTime) * 60);
 }
開發者ID:ppantilla,項目名稱:bbninja,代碼行數:8,代碼來源:joomlaCacheDriver.class.php

示例3: onJSolrSearchOptionLookup

 /**
  * A convenience event handler to obtain the text related to an option's 
  * value.
  * 
  * The event cache's the options for quicker lookup and to reduce load on 
  * the database. Therefore, there may be some delay between new items 
  * being added to JReviews and what is retrieved by this event. 
  * 
  * @param string $value The option's value.
  * @return string The text related to the option's value.
  */
 public function onJSolrSearchOptionLookup($value)
 {
     $conf = JFactory::getConfig();
     $options = array('defaultgroup' => 'plg_jsolrsearch_jreviews', 'cachebase' => $conf->getValue('config.cache_path'), 'lifetime' => $conf->getValue('config.cachetime') * 60, 'language' => $conf->getValue('config.language'), 'storage' => $conf->getValue('config.storage', 'file'));
     $cache = new JCache($options);
     $cache->setCaching(true);
     if (!($list = json_decode($cache->get('options', $options['defaultgroup'])))) {
         $database = JFactory::getDbo();
         $query = $database->getQuery(true);
         $query->select(array('text', 'value'))->from('#__jreviews_fieldoptions');
         $database->setQuery($query);
         $list = $database->loadObjectList();
         // cache these options so we don't need to keep loading from db.
         $cache->store(json_encode($list), $options['defaultgroup']);
     }
     $found = false;
     $text = "";
     while (!$found && ($item = current($list))) {
         if ($item->value == $value) {
             $found = true;
             $text = $item->text;
         }
         next($list);
     }
     return $text;
 }
開發者ID:bellodox,項目名稱:jsolr,代碼行數:37,代碼來源:jreviews.php

示例4: __construct

 /**
  * Constructor.
  *
  * @param	array	An optional associative array of configuration settings.
  * @see		JController
  * @since	1.6
  */
 public function __construct($config = array())
 {
     parent::__construct($config);
     //initialize vars
     $this->option = JFactory::getApplication()->input->get('option');
     $this->_comParams = JComponentHelper::getParams($this->option);
     //cache callbacks
     $this->_cache = JCache::getInstance('callback', array('defaultgroup' => $this->option, 'lifetime' => $this->_comParams->get('callback_lifetime', 86400)));
     $this->_cache->setCaching(true);
     //cache request
     $this->_cachePage = JCache::getInstance('output', array('defaultgroup' => $this->option, 'lifetime' => $this->_comParams->get('pages_lifetime', 86400)));
     $this->_cachePage->setCaching(true);
     //load helpers
     $this->loadHelper('document');
     $this->loadHelper('menu');
     $this->loadHelper('url');
 }
開發者ID:ursbraem,項目名稱:staticcontent,代碼行數:24,代碼來源:export.php

示例5: testClean

 /**
  * Testing clean().
  *
  * @return void
  */
 public function testClean()
 {
     $options = array('storage' => 'file');
     $this->object = JCache::getInstance('output', $options);
     $this->object->setCaching(true);
     $this->object->store('Now is the time for all good people to throw a party.', 42, '');
     $this->object->store('And this is the cache that tries men\'s souls', 43, '');
     $this->assertThat($this->object->get(43, ''), $this->equalTo('And this is the cache that tries men\'s souls'), 'Should retrieve the data properly');
     $this->assertThat($this->object->clean(''), $this->isTrue(), 'Should remove cached data');
     $this->assertThat($this->object->get(43, ''), $this->isFalse(), 'Should not retrieve the data properly');
     $this->assertThat($this->object->get(42, ''), $this->isFalse(), 'Should not retrieve the data properly');
 }
開發者ID:ramdesh,項目名稱:joomla-platform,代碼行數:17,代碼來源:JCacheTest.php

示例6: testClean

 /**
  * Testing clean().
  *
  * @return void
  */
 public function testClean()
 {
     $options = array('storage' => 'file');
     $this->object = JCache::getInstance('output', $options);
     $this->object->setCaching(true);
     $this->object->store($this->testData_A, 42, '');
     $this->object->store($this->testData_B, 43, '');
     $this->assertEquals($this->testData_B, $this->object->get(43, ''));
     $this->assertTrue($this->object->clean(''));
     $this->assertFalse($this->object->get(43, ''));
     $this->assertFalse($this->object->get(42, ''));
 }
開發者ID:joomla-projects,項目名稱:media-manager-improvement,代碼行數:17,代碼來源:JCacheTest.php

示例7: TuiyoInitiate

 /**
  * TuiyoInitiate::TuiyoInitiate()
  * Application Initiation metod
  * @return
  */
 public function TuiyoInitiate()
 {
     TuiyoInitiate::_setDefines();
     TuiyoInitiate::_loadErrorHandler();
     TuiyoInitiate::_localize();
     jimport('joomla.cache.cache');
     $conf =& JFactory::getConfig();
     $options = array('defaultgroup' => 'com_tuiyo', 'cachebase' => $conf->getValue('config.cache_path'), 'lifetime' => $conf->getValue('config.cachetime') * 60, 'language' => $conf->getValue('config.language'), 'storage' => 'file');
     $cache = new JCache($options);
     $cache->setCaching($conf->getValue('config.caching'));
     $GLOBALS['TUIYO_CACHE'] = $cache;
     //Load the parameters for the site!
     if (class_exists('JSite')) {
         TuiyoInitiate::_params();
     }
     //load all the plugins
     TuiyoInitiate::registerPlugins();
 }
開發者ID:night-coder,項目名稱:ignite,代碼行數:23,代碼來源:initiate.php

示例8: onAfterInitialise

 /**
  * Converting the site URL to fit to the HTTP request.
  *
  * @return  void
  *
  * @since   1.5
  */
 public function onAfterInitialise()
 {
     // Logger::d(__METHOD__);
     global $_PROFILER;
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     if ($app->isAdmin()) {
         return;
     }
     if (count($app->getMessageQueue())) {
         return;
     }
     if ($this->isDisabled()) {
         return;
     }
     if ($user->get('guest') && $app->input->getMethod() == 'GET') {
         $this->_cache->setCaching(true);
     }
 }
開發者ID:rustyJ4ck,項目名稱:joomla-page-cache,代碼行數:26,代碼來源:cache.new.php

示例9: setCaching

 /**
  * Set caching enabled state
  *
  * @param   boolean  $enabled  True to enable caching
  *
  * @return  void
  *
  * @since   11.1
  */
 public function setCaching($enabled)
 {
     $this->cache->setCaching($enabled);
 }
開發者ID:jimyb3,項目名稱:mathematicalteachingsite,代碼行數:13,代碼來源:controller.php


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