Implement a clear_cache function so that we can free up cached objects
This commit is contained in:
parent
8dfe7460f3
commit
f7e2359818
|
@ -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;
|
||||
|
|
|
@ -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 ) {
|
||||
|
|
Loading…
Reference in New Issue