/** * Flush the cached results for all relations (has_one, has_many, many_many) * Also clears any cached aggregate data. * * @param boolean $persistent When true will also clear persistent data stored in the Cache system. * When false will just clear session-local cached data * */ public function flushCache($persistent = true) { if ($persistent) { Aggregate::flushCache($this->class); } if ($this->class == 'DataObject') { DataObject::$_cache_get_one = array(); return; } $classes = ClassInfo::ancestry($this->class); foreach ($classes as $class) { if (isset(DataObject::$_cache_get_one[$class])) { unset(DataObject::$_cache_get_one[$class]); } } $this->extend('flushCache'); $this->components = array(); }
public function flushCache($persistent = true) { if ($persistent) { Aggregate::flushCache($this->class); } if ($this->class == 'ExternalDataObject') { ExternalDataObject::$_cache_get_one = array(); return $this; } $classes = class_parents($this->class) + array($this->class => $this->class); foreach ($classes as $class) { if (isset(ExternalDataObject::$_cache_get_one[$class])) { unset(ExternalDataObject::$_cache_get_one[$class]); } } $this->extend('flushCache'); return $this; }