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