Implement a remove_from_cache function so we can free mem for objects we are not interested in

This commit is contained in:
Isaac Connor 2020-08-27 17:14:47 -04:00
parent a5cef3e6d1
commit d0f6f8755c
2 changed files with 8 additions and 0 deletions

View File

@ -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 ) {

View File

@ -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();