Implement a remove_from_cache function so we can free mem for objects we are not interested in
This commit is contained in:
parent
a5cef3e6d1
commit
d0f6f8755c
|
@ -50,6 +50,9 @@ class Event extends ZM_Object {
|
|||
public static function clear_cache() {
|
||||
return ZM_Object::_clear_cache(get_class());
|
||||
}
|
||||
public function remove_from_cache() {
|
||||
return ZM_Object::_remove_from_cache(get_class(), $this);
|
||||
}
|
||||
|
||||
public function Storage( $new = null ) {
|
||||
if ( $new ) {
|
||||
|
|
|
@ -141,6 +141,11 @@ class ZM_Object {
|
|||
global $object_cache;
|
||||
$object_cache[$class] = array();
|
||||
}
|
||||
public function _remove_from_cache($class, $object) {
|
||||
global $object_cache;
|
||||
unset($object_cache[$class][$object->Id()]);
|
||||
Logger::Debug("Unsset $class " . $object->Id() . " " . count($object_cache[$class]));
|
||||
}
|
||||
|
||||
public static function Objects_Indexed_By_Id($class) {
|
||||
$results = array();
|
||||
|
|
Loading…
Reference in New Issue