本文整理匯總了PHP中JCacheStorage類的典型用法代碼示例。如果您正苦於以下問題:PHP JCacheStorage類的具體用法?PHP JCacheStorage怎麽用?PHP JCacheStorage使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了JCacheStorage類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
public function __construct($options = array())
{
$this->_root = JPATH_ADMINISTRATOR . '/cache';
$this->_hash = JFactory::getConfig()->get('secret');
$cache = new JCacheStorage();
$this->_cache = $cache->getInstance('file', array('cachebase' => $this->_root));
}
示例2: __construct
function __construct($options = array())
{
$config =& JFactory::getConfig();
jimport('joomla.cache.cache');
$cache = new JCacheStorage();
$this->_cache = $cache->getInstance('file', array('cachebase' => JPATH_ADMINISTRATOR . DS . 'cache'));
$this->_root = JPATH_ADMINISTRATOR . DS . 'cache';
$this->_hash = $config->getValue('config.secret');
}
示例3: getAll
/**
* Get all cached data
*
* This requires the php.ini setting xcache.admin.enable_auth = Off.
*
* @return array data
*
* @since 11.1
*/
public function getAll()
{
parent::getAll();
// Make sure XCache is configured properly
if (self::isSupported() == false) {
return array();
}
$allinfo = xcache_list(XC_TYPE_VAR, 0);
$keys = $allinfo['cache_list'];
$secret = $this->_hash;
$data = array();
foreach ($keys as $key) {
$namearr = explode('-', $key['name']);
if ($namearr !== false && $namearr[0] == $secret && $namearr[1] == 'cache') {
$group = $namearr[2];
if (!isset($data[$group])) {
$item = new JCacheStorageHelper($group);
} else {
$item = $data[$group];
}
$item->updateSize($key['size'] / 1024);
$data[$group] = $item;
}
}
return $data;
}
示例4: 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()
{
include_once JPATH_PLATFORM . '/joomla/cache/storage.php';
include_once JPATH_PLATFORM . '/joomla/cache/storage/xcache.php';
$this->xcacheAvailable = extension_loaded('xcache');
$this->object = JCacheStorage::getInstance('xcache');
}
示例5: 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();
$xcachetest = false;
if (extension_loaded('xcache')) {
// XCache Admin must be disabled for Joomla to use XCache
$xcache_admin_enable_auth = ini_get('xcache.admin.enable_auth');
// Some extensions ini variables are reported as strings
if ($xcache_admin_enable_auth == 'Off') {
$xcachetest = true;
}
// We require a string with contents 0, not a null value because it is not set since that then defaults to On/True
if ($xcache_admin_enable_auth === '0') {
$xcachetest = true;
}
// In some enviorments empty is equivalent to Off; See JC: #34044 && Github: #4083
if ($xcache_admin_enable_auth === '') {
$xcachetest = true;
}
}
$this->extensionAvailable = $xcachetest;
if ($this->extensionAvailable) {
$this->object = JCacheStorage::getInstance('xcache');
} else {
$this->markTestSkipped('This caching method is not supported on this system.');
}
}
示例6: getAll
/**
* Get all cached data
*
* @return array data
* @since 11.1
*/
public function getAll()
{
parent::getAll();
$allinfo = wincache_ucache_info();
$keys = $allinfo['cache_entries'];
$secret = $this->_hash;
$data = array();
foreach ($keys as $key) {
$name = $key['key_name'];
$namearr = explode('-', $name);
if ($namearr !== false && $namearr[0] == $secret && $namearr[1] == 'cache') {
$group = $namearr[2];
if (!isset($data[$group])) {
$item = new JCacheStorageHelper($group);
} else {
$item = $data[$group];
}
if (isset($key['value_size'])) {
$item->updateSize($key['value_size'] / 1024);
} else {
// Dummy, WINCACHE version is too low
$item->updateSize(1);
}
$data[$group] = $item;
}
}
return $data;
}
示例7: 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()
{
$memcachetest = false;
include_once JPATH_BASE.'/libraries/joomla/cache/storage.php';
include_once JPATH_BASE.'/libraries/joomla/cache/storage/memcache.php';
if((extension_loaded('memcache') && class_exists('Memcache')) != true ) {
$this->memcacheAvailable = false; } else {
$config = JFactory::getConfig();
$host = $config->get('memcache_server_host', 'localhost');
$port = $config->get('memcache_server_port',11211);
$memcache = new Memcache;
$memcachetest = @$memcache->connect($host, $port); }
if (!$memcachetest)
{
$this->memcacheAvailable = false;
} else $this->memcacheAvailable = true;
if ($this->memcacheAvailable)
{
$this->object = JCacheStorage::getInstance('memcache');
}
}
示例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_BASE . '/libraries/joomla/cache/storage.php';
include_once JPATH_BASE . '/libraries/joomla/cache/storage/eaccelerator.php';
$this->eacceleratorAvailable = extension_loaded('eaccelerator') && function_exists('eaccelerator_get');
$this->object = JCacheStorage::getInstance('eaccelerator');
}
示例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()
{
include_once JPATH_PLATFORM . '/joomla/cache/storage.php';
include_once JPATH_PLATFORM . '/joomla/cache/storage/file.php';
$this->object = JCacheStorage::getInstance('file', array('cachebase' => JPATH_BASE . '/cache'));
}
示例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/storage.php';
include_once JPATH_BASE . '/libraries/joomla/cache/storage/apc.php';
$this->object = JCacheStorage::getInstance('apc');
$this->apcAvailable = extension_loaded('apc');
}
示例11: 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/storage.php';
include_once JPATH_PLATFORM . '/joomla/cache/storage/apc.php';
$this->object = JCacheStorage::getInstance('apc');
$this->apcAvailable = extension_loaded('apc');
}
示例12: 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();
$this->extensionAvailable = extension_loaded('wincache') && function_exists('wincache_ucache_get') && !strcmp(ini_get('wincache.ucenabled'), '1');
if ($this->extensionAvailable) {
$this->object = JCacheStorage::getInstance('wincache');
} else {
$this->markTestSkipped('This caching method is not supported on this system.');
}
}
示例13: array
/**
* Constructor
*
* @param array $options optional parameters
*/
function __construct( $options = array() )
{
parent::__construct($options);
$config =& JFactory::getConfig();
$this->_hash = $config->get('secret');
}
示例14: testTest
/**
* Testing test().
*
* @return void
*/
public function testTest()
{
$this->assertThat(
$this->object->test(),
$this->isTrue()
);
}
示例15: array
/**
* Constructor
*
* @access protected
* @param array $options optional parameters
*/
function __construct($options = array())
{
if (!$this->test()) {
return JError::raiseError(404, "The memcache extension is not available");
}
parent::__construct($options);
$config =& JFactory::getConfig();
$params = $config->getValue('config.memcache_settings');
if (!is_array($params)) {
$params = unserialize(stripslashes($params));
}
if (!$params) {
$params = array();
}
$this->_compress = isset($params['compression']) ? $params['compression'] : 0;
$this->_persistent = isset($params['persistent']) ? $params['persistent'] : false;
// This will be an array of loveliness
$this->_servers = isset($params['servers']) ? $params['servers'] : array();
// Create the memcache connection
$this->_db = new Memcache();
for ($i = 0, $n = count($this->_servers); $i < $n; $i++) {
$server = $this->_servers[$i];
$this->_db->addServer($server['host'], $server['port'], $this->_persistent);
}
// Get the site hash
$this->_hash = $config->getValue('config.secret');
}