Beispiel #1
0
 /**
  * Resets the cached values for all.
  * @return void
  */
 public static function clearTreeCache()
 {
     static::$objectCache = [];
     static::$parentCache = [];
     static::$cacheSortColumn = [];
 }
Beispiel #2
0
 /**
  * Remove instance or whole class from cache or wipe cache out
  * 
  * If $class and $id are given only instance is removed
  * If only $class is given all instances of the class are removed
  * If none of $class and $id are given all instances of all classes are removed
  * 
  * @param string $class class name
  * @param mixed $id unique identifier
  * 
  * @return bool tells if instance/class was registered
  */
 public static function purgeCache($id = null)
 {
     if ($id) {
         if (!array_key_exists($id, static::$objectCache)) {
             return false;
         }
         unset(static::$objectCache[$id]);
     } else {
         static::$objectCache = array();
     }
     return true;
 }