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


PHP JCache类代码示例

本文整理汇总了PHP中JCache的典型用法代码示例。如果您正苦于以下问题:PHP JCache类的具体用法?PHP JCache怎么用?PHP JCache使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getInput

 /**
  * @return string
  */
 protected function getInput()
 {
     $file_cache = new JCache(array('defaultgroup' => 'rokbooster', 'caching' => true, 'checkTime' => true, 'storage' => 'file', 'cachebase' => JPATH_SITE . '/cache'));
     $files = $file_cache->getAll();
     $filecount = 0;
     if (is_array($files) && array_key_exists('rokbooster', $files)) {
         $filecount = $files['rokbooster']->count;
     }
     return '<div class="clearcache btn btn-primary" data-action="clearCache"><i>' . JText::_('ROKBOOSTER_BUTTON_CLEAR_CACHE') . '<span class="count">' . $filecount . '</span></i></div>';
 }
开发者ID:laiello,项目名称:senluonirvana,代码行数:13,代码来源:clearcache.php

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

示例3: getCss

	function getCss ($path) {
		$app = JFactory::getApplication();
		// get vars last-modified
		$vars_lm = $app->getUserState('vars_last_modified', 0);

		// less file last-modified
		$filepath = JPATH_ROOT.'/'.$path;
		$less_lm = filemtime ($filepath);

		// cache key
		$key = md5 ($vars_lm.':'.$less_lm.':'.$path);
		$group = 't3';
		$cache = JCache::getInstance ('output', array('lifetime'=>1440));
		// get cache
		$data = $cache->get ($key, $group);
		if ($data) {
			return $data;
		}

		// not cached, build & store it
		$data = $this->compileCss ($path)."\n";
		$cache->store ($data, $key, $group);

		return $data;
	}
开发者ID:GitIPFire,项目名称:Homeworks,代码行数:25,代码来源:less.php

示例4: getInput

 /**
  * @return string
  */
 protected function getInput()
 {
     if (!self::$assets_loaded) {
         $doc = JFactory::getDocument();
         $doc->addStyleSheet(JURI::root(true) . '/plugins/system/rokbooster/fields/assets/clearcache/css/clearcache.css');
         $doc->addScript(JURI::root(true) . '/plugins/system/rokbooster/fields/assets/clearcache/js/RokBooster.js');
         self::$assets_loaded = true;
     }
     $file_cache = new JCache(array('defaultgroup' => 'rokbooster', 'caching' => true, 'checkTime' => true, 'storage' => 'file', 'cachebase' => JPATH_SITE . '/cache'));
     $files = $file_cache->getAll();
     $filecount = 0;
     if (is_array($files) && array_key_exists('rokbooster', $files)) {
         $filecount = $files['rokbooster']->count;
     }
     return '<div class="clearcache btn btn-primary" data-action="clearCache"><i>' . JText::_('ROKBOOSTER_BUTTON_CLEAR_CACHE') . '<span class="count">' . $filecount . '</span></i></div>';
 }
开发者ID:interfaceslivres,项目名称:ccmd-ufpb,代码行数:19,代码来源:clearcache.php

示例5: getCache

 private function getCache()
 {
     $conf = JFactory::getConfig();
     $options = array('defaultgroup' => '', 'storage' => $conf->get('cache_handler', ''), 'caching' => true, 'cachebase' => $conf->get('cache_path', JPATH_SITE . '/cache'));
     $cache = JCache::getInstance('', $options);
     return $cache;
 }
开发者ID:AlexanderKri,项目名称:joom-upd,代码行数:7,代码来源:joomla.php

示例6: cleanCache

 /**
  * Clean the cache.
  * It also cleans the simplecustomrouter plugin cache, as the routes
  * configured by this component are used by that plugin.
  * 
  * This method is called when needed from parent models.
  * 
  * @param string $group The cache group
  * @param string $client_id The ID of the client
  */
 protected function cleanCache($group = null, $client_id = 0)
 {
     $conf = JFactory::getConfig();
     $options = array('defaultgroup' => 'simplecustomrouter', 'cachebase' => $conf->get('cache_path', JPATH_SITE . '/cache'));
     $cache = JCache::getInstance('', $options)->clean();
     parent::cleanCache($group, $client_id);
 }
开发者ID:A-Bush,项目名称:pprod,代码行数:17,代码来源:route.php

示例7: __construct

 /**
  *  constructor
  */
 function __construct(&$subject, $config)
 {
     global $_PROFILER;
     $mainframe = JFactory::getApplication();
     parent::__construct($subject, $config);
     // if page cache is enabled.
     if ($this->params->get('enable_cache', 0)) {
         //Set the language in the class
         $config =& JFactory::getConfig();
         $options = array('cachebase' => JPATH_BASE . DS . 'cache', 'defaultgroup' => 'page', 'lifetime' => $this->params->get('cachetime', 15) * 60, 'enable_cache' => $this->params->get('enable_cache', 1) ? true : false, 'caching' => false, 'language' => $config->getValue('config.language', 'en-GB'));
         file_put_contents(JPATH_BASE . DS . 'cache' . DS . 'time.txt', $this->params->get('cachetime', 15) * 60);
         jimport('joomla.cache.cache');
         $this->_cache = JCache::getInstance('page', $options);
         $menu = $this->params->get('menu', '');
         if ($menu != '') {
             $this->_ItemidsCached = !is_array($menu) ? array($menu) : $menu;
         }
     }
     // process clear cache from client request
     if (JRequest::getVar('icespeed')) {
         $this->processClearCacheRequest();
     }
     if ($mainframe->isAdmin()) {
         // load js and css for proccessing client action.
         PlgIceSpeedHelper::loadAdminMediaFiles('ice_speed');
         // trigger clear cache: automatic clear cache after saved, applied.
         if (JRequest::getVar('task') == 'apply' || JRequest::getVar('task') == 'save') {
             $this->processClearCacheRequest();
         }
     }
 }
开发者ID:optimosolution,项目名称:marhk,代码行数:34,代码来源:ice_speed.php

示例8: setUp

 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @return void
  * @access protected
  */
 protected function setUp()
 {
     include_once JPATH_PLATFORM . '/joomla/cache/cache.php';
     include_once JPATH_PLATFORM . '/joomla/cache/controller.php';
     include_once JPATH_PLATFORM . '/joomla/cache/controller/output.php';
     $this->object = JCache::getInstance('output', array());
 }
开发者ID:nibra,项目名称:joomla-platform,代码行数:14,代码来源:JCacheControllerOutputTest.php

示例9: __construct

 public function __construct($groupName)
 {
     $this->cache = JFactory::getCache($groupName, 'output');
     $handler = 'output';
     $options = array('storage' => 'file', 'defaultgroup' => $groupName, 'locking' => true, 'locktime' => 15, 'checkTime' => false, 'caching' => true);
     $this->cache = JCache::getInstance($handler, $options);
 }
开发者ID:interfaceslivres,项目名称:ccmd-ufpb,代码行数:7,代码来源:joomlaNoExpireCacheDriver.php

示例10: setUp

 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @return void
  * @access protected
  */
 protected function setUp()
 {
     include_once JPATH_BASE . '/libraries/joomla/cache/cache.php';
     include_once JPATH_BASE . '/libraries/joomla/cache/controller.php';
     include_once JPATH_BASE . '/libraries/joomla/cache/controller/page.php';
     $this->object = JCache::getInstance('page', array());
 }
开发者ID:Joomla-on-NoSQL,项目名称:LaMojo,代码行数:14,代码来源:JCacheControllerPageTest.php

示例11: update

 function update()
 {
     $currency = JRequest::getInt('hikashopcurrency', 0);
     if (!empty($currency)) {
         $app = JFactory::getApplication();
         $app->setUserState(HIKASHOP_COMPONENT . '.currency_id', $currency);
         $app->setUserState(HIKASHOP_COMPONENT . '.shipping_method', null);
         $app->setUserState(HIKASHOP_COMPONENT . '.shipping_id', null);
         $app->setUserState(HIKASHOP_COMPONENT . '.shipping_data', null);
         $app->setUserState(HIKASHOP_COMPONENT . '.payment_method', null);
         $app->setUserState(HIKASHOP_COMPONENT . '.payment_id', null);
         $app->setUserState(HIKASHOP_COMPONENT . '.payment_data', null);
         $url = JRequest::getString('return_url', '');
         if (HIKASHOP_J30) {
             $plugin = JPluginHelper::getPlugin('system', 'cache');
             $params = new JRegistry(@$plugin->params);
             $options = array('defaultgroup' => 'page', 'browsercache' => $params->get('browsercache', false), 'caching' => false);
             $cache = JCache::getInstance('page', $options);
             $cache->clean();
         }
         if (!empty($url)) {
             if (hikashop_disallowUrlRedirect($url)) {
                 return false;
             }
             $app->redirect(urldecode($url));
         }
     }
     return true;
 }
开发者ID:q0821,项目名称:esportshop,代码行数:29,代码来源:currency.php

示例12: showConfig

 /**
  * Show the configuration edit form
  * @param string The URL option
  */
 public static function showConfig()
 {
     // Initialize some variables
     $db =& JFactory::getDBO();
     $row = new JConfig();
     // compile list of the languages
     $langs = array();
     $menuitems = array();
     $lists = array();
     // PRE-PROCESS SOME LIST
     // -- Show/Hide --
     $show_hide = array(JHTML::_('select.option', 1, JText::_('Hide')), JHTML::_('select.option', 0, JText::_('Show')));
     $show_hide_r = array(JHTML::_('select.option', 0, JText::_('Hide')), JHTML::_('select.option', 1, JText::_('Show')));
     // DEBUG
     $lists['debug'] = JHTML::_('select.booleanlist', 'debug', 'class="inputbox"', $row->debug);
     $lists['debug_lang'] = JHTML::_('select.booleanlist', 'debug_lang', 'class="inputbox"', $row->debug_lang);
     // DATABASE SETTINGS
     // SERVER SETTINGS
     $errors = array(JHTML::_('select.option', -1, JText::_('System Default')), JHTML::_('select.option', 0, JText::_('None')), JHTML::_('select.option', E_ERROR | E_WARNING | E_PARSE, JText::_('Simple')), JHTML::_('select.option', E_ALL ^ E_STRICT, JText::_('Maximum')));
     $lists['error_reporting'] = JHTML::_('select.genericlist', $errors, 'error_reporting', 'class="inputbox" size="1"', 'value', 'text', $row->error_reporting);
     $lists['enable_ftp'] = JHTML::_('select.booleanlist', 'ftp_enable', 'class="inputbox"', intval($row->ftp_enable));
     // LOCALE SETTINGS
     $timeoffset = array(JHTML::_('select.option', -12, JText::_('(UTC -12:00) International Date Line West')), JHTML::_('select.option', -11, JText::_('(UTC -11:00) Midway Island, Samoa')), JHTML::_('select.option', -10, JText::_('(UTC -10:00) Hawaii')), JHTML::_('select.option', -9.5, JText::_('(UTC -09:30) Taiohae, Marquesas Islands')), JHTML::_('select.option', -9, JText::_('(UTC -09:00) Alaska')), JHTML::_('select.option', -8, JText::_('(UTC -08:00) Pacific Time (US &amp; Canada)')), JHTML::_('select.option', -7, JText::_('(UTC -07:00) Mountain Time (US &amp; Canada)')), JHTML::_('select.option', -6, JText::_('(UTC -06:00) Central Time (US &amp; Canada), Mexico City')), JHTML::_('select.option', -5, JText::_('(UTC -05:00) Eastern Time (US &amp; Canada), Bogota, Lima')), JHTML::_('select.option', -4.5, JText::_('(UTC -04:30) Venezuela')), JHTML::_('select.option', -4, JText::_('(UTC -04:00) Atlantic Time (Canada), Caracas, La Paz')), JHTML::_('select.option', -3.5, JText::_('(UTC -03:30) St. John\'s, Newfoundland, Labrador')), JHTML::_('select.option', -3, JText::_('(UTC -03:00) Brazil, Buenos Aires, Georgetown')), JHTML::_('select.option', -2, JText::_('(UTC -02:00) Mid-Atlantic')), JHTML::_('select.option', -1, JText::_('(UTC -01:00) Azores, Cape Verde Islands')), JHTML::_('select.option', 0, JText::_('(UTC 00:00) Western Europe Time, London, Lisbon, Casablanca')), JHTML::_('select.option', 1, JText::_('(UTC +01:00) Amsterdam, Berlin, Brussels, Copenhagen, Madrid, Paris')), JHTML::_('select.option', 2, JText::_('(UTC +02:00) Istanbul, Jerusalem, Kaliningrad, South Africa')), JHTML::_('select.option', 3, JText::_('(UTC +03:00) Baghdad, Riyadh, Moscow, St. Petersburg')), JHTML::_('select.option', 3.5, JText::_('(UTC +03:30) Tehran')), JHTML::_('select.option', 4, JText::_('(UTC +04:00) Abu Dhabi, Muscat, Baku, Tbilisi')), JHTML::_('select.option', 4.5, JText::_('(UTC +04:30) Kabul')), JHTML::_('select.option', 5, JText::_('(UTC +05:00) Ekaterinburg, Islamabad, Karachi, Tashkent')), JHTML::_('select.option', 5.5, JText::_('(UTC +05:30) Bombay, Calcutta, Madras, New Delhi, Colombo')), JHTML::_('select.option', 5.75, JText::_('(UTC +05:45) Kathmandu')), JHTML::_('select.option', 6, JText::_('(UTC +06:00) Almaty, Dhaka')), JHTML::_('select.option', 6.5, JText::_('(UTC +06:30) Yagoon')), JHTML::_('select.option', 7, JText::_('(UTC +07:00) Bangkok, Hanoi, Jakarta')), JHTML::_('select.option', 8, JText::_('(UTC +08:00) Beijing, Perth, Singapore, Hong Kong')), JHTML::_('select.option', 8.75, JText::_('(UTC +08:00) Ulaanbaatar, Western Australia')), JHTML::_('select.option', 9, JText::_('(UTC +09:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk')), JHTML::_('select.option', 9.5, JText::_('(UTC +09:30) Adelaide, Darwin, Yakutsk')), JHTML::_('select.option', 10, JText::_('(UTC +10:00) Eastern Australia, Guam, Vladivostok')), JHTML::_('select.option', 10.5, JText::_('(UTC +10:30) Lord Howe Island (Australia)')), JHTML::_('select.option', 11, JText::_('(UTC +11:00) Magadan, Solomon Islands, New Caledonia')), JHTML::_('select.option', 11.5, JText::_('(UTC +11:30) Norfolk Island')), JHTML::_('select.option', 12, JText::_('(UTC +12:00) Auckland, Wellington, Fiji, Kamchatka')), JHTML::_('select.option', 12.75, JText::_('(UTC +12:45) Chatham Island')), JHTML::_('select.option', 13, JText::_('(UTC +13:00) Tonga')), JHTML::_('select.option', 14, JText::_('(UTC +14:00) Kiribati')));
     $lists['offset'] = JHTML::_('select.genericlist', $timeoffset, 'offset', 'class="inputbox" size="1"', 'value', 'text', $row->offset);
     // MAIL SETTINGS
     $mailer = array(JHTML::_('select.option', 'mail', JText::_('PHP mail function')), JHTML::_('select.option', 'sendmail', JText::_('Sendmail')), JHTML::_('select.option', 'smtp', JText::_('SMTP Server')));
     $lists['mailer'] = JHTML::_('select.genericlist', $mailer, 'mailer', 'class="inputbox" size="1"', 'value', 'text', $row->mailer);
     $smtpsecure = array(JHTML::_('select.option', 'none', JText::_('None')), JHTML::_('select.option', 'ssl', 'SSL'), JHTML::_('select.option', 'tls', 'TLS'));
     $lists['smtpsecure'] = JHTML::_('select.genericlist', $smtpsecure, 'smtpsecure', 'class="inputbox" size="1"', 'value', 'text', isset($row->smtpsecure) ? $row->smtpsecure : '');
     $lists['smtpauth'] = JHTML::_('select.booleanlist', 'smtpauth', 'class="inputbox"', $row->smtpauth);
     // CACHE SETTINGS
     $lists['caching'] = JHTML::_('select.booleanlist', 'caching', 'class="inputbox"', $row->caching);
     jimport('joomla.cache.cache');
     $stores = JCache::getStores();
     $options = array();
     foreach ($stores as $store) {
         $options[] = JHTML::_('select.option', $store, JText::_(ucfirst($store)));
     }
     $lists['cache_handlers'] = JHTML::_('select.genericlist', $options, 'cache_handler', 'class="inputbox" size="1"', 'value', 'text', $row->cache_handler);
     // MEMCACHE SETTINGS
     if (!empty($row->memcache_settings) && !is_array($row->memcache_settings)) {
         $row->memcache_settings = unserialize(stripslashes($row->memcache_settings));
     }
     $lists['memcache_persist'] = JHTML::_('select.booleanlist', 'memcache_settings[persistent]', 'class="inputbox"', @$row->memcache_settings['persistent']);
     $lists['memcache_compress'] = JHTML::_('select.booleanlist', 'memcache_settings[compression]', 'class="inputbox"', @$row->memcache_settings['compression']);
     // SEO SETTINGS
     $lists['sef'] = JHTML::_('select.booleanlist', 'sef', 'class="inputbox"', $row->sef);
     $lists['sef_rewrite'] = JHTML::_('select.booleanlist', 'sef_rewrite', 'class="inputbox"', $row->sef_rewrite);
     $lists['sef_suffix'] = JHTML::_('select.booleanlist', 'sef_suffix', 'class="inputbox"', $row->sef_suffix);
     // SESSION SETTINGS
     $stores = JSession::getStores();
     $options = array();
     foreach ($stores as $store) {
         $options[] = JHTML::_('select.option', $store, JText::_(ucfirst($store)));
     }
     $lists['session_handlers'] = JHTML::_('select.genericlist', $options, 'session_handler', 'class="inputbox" size="1"', 'value', 'text', $row->session_handler);
     // SHOW EDIT FORM
     ConfigApplicationView::showConfig($row, $lists);
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:63,代码来源:application.php

示例13: __construct

 /**
  * Constructor.
  *
  * @param   object  &$subject  The object to observe.
  * @param   array   $config    An optional associative array of configuration settings.
  *
  * @since   1.5
  */
 public function __construct(&$subject, $config)
 {
     parent::__construct($subject, $config);
     // Set the language in the class.
     $options = array('defaultgroup' => 'page', 'browsercache' => $this->params->get('browsercache', false), 'caching' => false);
     $this->_cache = JCache::getInstance('page', $options);
     $this->_cache_key = JUri::getInstance()->toString();
 }
开发者ID:01J,项目名称:skazkipronebo,代码行数:16,代码来源:cache.php

示例14: __construct

 /**
  * Constructor
  *
  * @access	protected
  * @param	object	$subject The object to observe
  * @param	array	$config  An array that holds the plugin configuration
  * @since	1.0
  */
 function __construct(&$subject, $config)
 {
     parent::__construct($subject, $config);
     //Set the language in the class
     $config = JFactory::getConfig();
     $options = array('defaultgroup' => 'page', 'browsercache' => $this->params->get('browsercache', false), 'caching' => false);
     $this->_cache = JCache::getInstance('page', $options);
 }
开发者ID:jimyb3,项目名称:mathematicalteachingsite,代码行数:16,代码来源:cache.php

示例15: getJoomlaMenuItems

 /**
  * Recupera una lista de los items de menu publicados en Joomla!
  *
  * @return array Lista de menùes recuperados
  */
 function getJoomlaMenuItems()
 {
     $dbo =& JFactory::getDBO();
     $query = 'SELECT ' . $dbo->nameQuote('m.id') . ', ' . $dbo->nameQuote('m.name') . ' FROM ' . $dbo->nameQuote('#__menu') . ' m' . ' WHERE ' . $dbo->nameQuote('published') . ' = 1';
     $dbo->setQuery($query);
     return $this->_cache->get(array($dbo, 'loadObjectList'), array());
 }
开发者ID:BGCX261,项目名称:zonales-svn-to-git,代码行数:12,代码来源:helper.php


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