API15:JCacheStorageMemcache/getConnection
From Joomla! Documentation
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.
Contents |
Description
return memcache connection object
Description:JCacheStorageMemcache/getConnection
Syntax
& getConnection()
Returns
object memcache connection object
Defined in
libraries/joomla/cache/storage/memcache.php
Importing
jimport( 'joomla.cache.storage.memcache' );
Source Body
function &getConnection() { static $db = null; if(is_null($db)) { $params =& JCacheStorageMemcache::getConfig(); $persistent = (isset($params['persistent'])) ? $params['persistent'] : false; // This will be an array of loveliness $servers = (isset($params['servers'])) ? $params['servers'] : array(); // Create the memcache connection $db = new Memcache; foreach($servers AS $server) { $db->addServer($server['host'], $server['port'], $persistent); } } return $db; }
[Edit See Also] SeeAlso:JCacheStorageMemcache/getConnection
Examples
<CodeExamplesForm />
