Elgg  Version 2.2
 All Classes Namespaces Files Functions Variables Pages
memcache.php
Go to the documentation of this file.
1 <?php
17  global $CONFIG;
18 
19  static $memcache_available;
20 
21  if ((!isset($CONFIG->memcache)) || (!$CONFIG->memcache)) {
22  return false;
23  }
24 
25  // If we haven't set variable to something
26  if (($memcache_available !== true) && ($memcache_available !== false)) {
27  try {
28  $tmp = new \ElggMemcache();
29  // No exception thrown so we have memcache available
30  $memcache_available = true;
31  } catch (Exception $e) {
32  $memcache_available = false;
33  }
34  }
35 
36  return $memcache_available;
37 }
38 
48  static $newentity_cache;
49 
50  if ((!$newentity_cache) && (is_memcache_available())) {
51  $newentity_cache = new \ElggMemcache('new_entity_cache');
52  }
53 
54  if ($newentity_cache) {
55  $newentity_cache->delete($entity_guid);
56  }
57 }
$e
Definition: metadata.php:12
$entity_guid
Definition: save.php:9
global $CONFIG
_elgg_invalidate_memcache_for_entity($entity_guid)
Invalidate an entity in memcache.
Definition: memcache.php:47
is_memcache_available()
Return true if memcache is available and configured.
Definition: memcache.php:16