20     private static $MINSERVERVERSION = 
'1.1.12';
 
   30     private $expires = 86400;
 
   52         if (!class_exists(
'Memcache')) {
 
   53             throw new \ConfigurationException(
'PHP memcache module not installed, you must install php5-memcache');
 
   57         $this->memcache = 
new Memcache;
 
   60         if (!$this->CONFIG->memcache_servers) {
 
   61             throw new \ConfigurationException(
'No memcache servers defined, please populate the $this->CONFIG->memcache_servers variable');
 
   64         if (is_callable(array($this->memcache, 
'addServer'))) {
 
   65             foreach ($this->CONFIG->memcache_servers as $server) {
 
   66                 if (is_array($server)) {
 
   67                     $this->memcache->addServer(
 
   69                         isset($server[1]) ? $server[1] : 11211,
 
   70                         isset($server[2]) ? $server[2] : 
false,
 
   71                         isset($server[3]) ? $server[3] : 1,
 
   72                         isset($server[4]) ? $server[4] : 1,
 
   73                         isset($server[5]) ? $server[5] : 15,
 
   74                         isset($server[6]) ? $server[6] : 
true 
   78                     $this->memcache->addServer($server, 11211);
 
   85             _elgg_services()->logger->error(
"This version of the PHP memcache API doesn't support multiple servers.");
 
   87             $server = $this->CONFIG->memcache_servers[0];
 
   88             if (is_array($server)) {
 
   89                 $this->memcache->connect($server[0], $server[1]);
 
   91                 $this->memcache->addServer($server, 11211);
 
   96         $this->
version = $this->memcache->getVersion();
 
   97         if (version_compare($this->
version, \ElggMemcache::$MINSERVERVERSION, 
'<')) {
 
   98             $msg = vsprintf(
'Memcache needs at least version %s to run, you are running %s',
 
   99                 array(\ElggMemcache::$MINSERVERVERSION,
 
  103             throw new \ConfigurationException($msg);
 
  107         if (isset($this->CONFIG->memcache_expires)) {
 
  108             $this->expires = $this->CONFIG->memcache_expires;
 
  112         _elgg_services()->events->registerHandler(
'cache:flush', 
'system', array($this, 
'clear'));
 
  123         $this->expires = $expires;
 
  134     private function makeMemcacheKey(
$key) {
 
  137         if (strlen($prefix . 
$key) > 250) {
 
  141         return $prefix . 
$key;
 
  154         $key = $this->makeMemcacheKey(
$key);
 
  156         if ($expires === 
null) {
 
  157             $expires = $this->expires;
 
  180         $key = $this->makeMemcacheKey(
$key);
 
  200         $key = $this->makeMemcacheKey(
$key);
 
  202         return $this->memcache->delete(
$key, 0);
 
  211         $result = $this->memcache->flush();
 
  213             _elgg_services()->logger->info(
"MEMCACHE: failed to flush {$this->getNamespace()}");
 
  217             _elgg_services()->logger->info(
"MEMCACHE: flushed {$this->getNamespace()}");
 
save($key, $data, $expires=null)
Saves a name and value to the cache.
 
clear()
Clears the entire cache.
 
setDefaultExpiry($expires=0)
Set the default expiry.
 
__construct($namespace='default')
Connect to memcache.
 
load($key, $offset=0, $limit=null)
Retrieves data.
 
getNamespace()
Get the namespace currently defined.
 
setNamespace($namespace="default")
Set the namespace of this cache.
 
echo; $lib_dir='js/lib'; $classes_dir='js/classes'; $files=array('vendors/sprintf', "$lib_dir/elgglib", "$classes_dir/ElggEntity", "$classes_dir/ElggUser", "$classes_dir/ElggPriorityList", "$lib_dir/prototypes", "$lib_dir/hooks", "$lib_dir/security", "$lib_dir/languages", "$lib_dir/ajax", "$lib_dir/session", "$lib_dir/pageowner", "$lib_dir/configuration", "$lib_dir/comments", "$lib_dir/ui", "$lib_dir/ui.widgets",); $root_path=elgg_get_root_path();foreach( $files as $file) { readfile("{$root_path}$file.js");echo "\n";}?> elgg version