Implement a clear_cache function so that we can free up cached objects

This commit is contained in:
Isaac Connor 2020-01-13 10:57:56 -05:00
parent 8dfe7460f3
commit f7e2359818
2 changed files with 9 additions and 0 deletions

View File

@ -47,6 +47,10 @@ class Event extends ZM_Object {
return ZM_Object::_find_one(get_class(), $parameters, $options);
}
public static function clear_cahce() {
return ZM_Object::_clear_cache(get_class());
}
public function Storage( $new = null ) {
if ( $new ) {
$this->{'Storage'} = $new;

View File

@ -128,6 +128,11 @@ class ZM_Object {
return $results[0];
}
public static function _clear_cache($class) {
global $object_cache;
$object_cache[$class] = array();
}
public static function Objects_Indexed_By_Id($class) {
$results = array();
foreach ( ZM_Object::_find($class, null, array('order'=>'lower(Name)')) as $Object ) {