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


PHP JCache::getInstance方法代碼示例

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


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

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

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

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

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

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

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

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

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

示例9: setUp

 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @return void
  */
 protected function setUp()
 {
     parent::setUp();
     include_once JPATH_PLATFORM . '/joomla/cache/cache.php';
     include_once JPATH_PLATFORM . '/joomla/cache/controller.php';
     include_once JPATH_PLATFORM . '/joomla/cache/controller/callback.php';
     $this->object = JCache::getInstance('callback', array());
 }
開發者ID:ZerGabriel,項目名稱:joomla-platform,代碼行數:14,代碼來源:JCacheControllerCallbackTest.php

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

示例11: getCacheObject

 /**
  * 
  * @param type $type
  * @return type
  */
 public static function getCacheObject($type = 'callback', $lifetime = 86400)
 {
     $aOptions = array('defaultgroup' => 'plg_jch_optimize', 'checkTime' => TRUE, 'application' => 'site', 'language' => 'en-GB', 'cachebase' => JPATH_SITE . '/cache', 'storage' => 'file');
     $oCache = JCache::getInstance($type, $aOptions);
     $oCache->setCaching(TRUE);
     $oCache->setLifeTime($lifetime);
     return $oCache;
 }
開發者ID:naka211,項目名稱:myloyal,代碼行數:13,代碼來源:cache.php

示例12: testConstruct

 /**
  * Test...
  *
  * @param   string  $type  @todo
  *
  * @dataProvider provider
  *
  * @return void
  */
 public function testConstruct($type)
 {
     $class = 'JCacheController' . ucfirst($type);
     $cache =& JCache::getInstance($type);
     $this->assertTrue($cache instanceof $class, 'Expecting= ' . $class . ' Returned= ' . get_class($cache));
     $cache2 =& JCache::getInstance($type);
     $this->assertTrue($cache !== $cache2, 'Type: ' . $type . ' Recieved the same instance twice');
 }
開發者ID:sural98,項目名稱:joomla-cms,代碼行數:17,代碼來源:JCacheConstructTest.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('cachebase' => JPATH_BASE . DS . 'cache', 'defaultgroup' => 'page', 'lifetime' => $this->params->get('cachetime', 15) * 60, 'browsercache' => $this->params->get('browsercache', false), 'caching' => false, 'language' => $config->getValue('config.language', 'en-GB'));
     jimport('joomla.cache.cache');
     $this->_cache =& JCache::getInstance('page', $options);
 }
開發者ID:joebushi,項目名稱:joomla,代碼行數:17,代碼來源:cache.php

示例15: _getCacheObject

 /**
  * 
  * @param type $type
  * @return type
  */
 private static function _getCacheObject($type, $lifetime)
 {
     if (static::${$type . 'Cache'} !== null) {
         return static::${$type . 'Cache'};
     }
     $aOptions = array('defaultgroup' => 'plg_jch_optimize', 'checkTime' => TRUE, 'caching' => TRUE, 'application' => 'site', 'language' => 'en-GB', 'lifetime' => $lifetime);
     static::${$type . 'Cache'} = JCache::getInstance($type, $aOptions);
     return static::${$type . 'Cache'};
 }
開發者ID:educakanchay,項目名稱:educa,代碼行數:14,代碼來源:cache.php


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