当前位置: 首页>>代码示例>>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;未经允许,请勿转载。