performance optimization

This commit is contained in:
Frank Schubert
2022-02-16 00:38:43 +01:00
parent 9ed06991e4
commit ad1c25c7c1
3 changed files with 52 additions and 8 deletions

View File

@@ -145,7 +145,7 @@ class Workflowvalue extends mfBaseModel {
}
if($name == "changer") {
$user = mfValuecache::singleton()->get("Worker-id-".$this->changed);
$user = mfValuecache::singleton()->get("Worker-id-".$this->changed_by);
if($user) {
$this->changer = $user;
return $this->changer;
@@ -153,7 +153,7 @@ class Workflowvalue extends mfBaseModel {
if($this->changed && $this->changed_by) {
$this->changer = new User($this->changed_by);
if($this->changer->id) {
mfValuecache::singleton()->set("Worker-id-".$this->changed, $this->changer);
mfValuecache::singleton()->set("Worker-id-".$this->changed_by, $this->changer);
}
return $this->changer;
} else {
@@ -163,9 +163,13 @@ class Workflowvalue extends mfBaseModel {
$classname = ucfirst($name);
$idfield = $name."_id";
$this->$name = new $classname($this->$idfield);
$this->$name = mfValuecache::singleton()->get("mfObjectmodel-$name-".$this->$idfield);
if(!$this->$name) {
$this->$name = new $classname($this->$idfield);
}
if($this->$name->id) {
mfValuecache::singleton()->set("mfObjectmodel-$name-".$this->$name->id, $this->$name);
return $this->$name;
} else {
return null;