performance optimizations

This commit is contained in:
Frank Schubert
2022-02-15 23:12:19 +01:00
parent fa3dec263f
commit c189041b67
10 changed files with 72 additions and 36 deletions

View File

@@ -11,11 +11,11 @@ class Workflowvalue extends mfBaseModel {
public $is_changed = false;
protected function init() {
$this->me = mfValuecache::get("me");
$this->me = mfValuecache::singleton()->get("me");
if(!$this->me) {
$this->me = new User();
$this->me->loadMe();
mfValuecache::set("me", $this->me);
mfValuecache::singleton()->set("me", $this->me);
}
}
@@ -133,12 +133,19 @@ class Workflowvalue extends mfBaseModel {
if($this->$name == null) {
if($name == "item") {
$this->item = new Workflowitem($this->item_id);
$this->item = mfValuecache::singleton()->get("wfItem-id-".$this->item_id);
if(!$this->item) {
$this->item = new Workflowitem($this->item_id);
if($this->item->id) {
mfValuecache::singleton()->set("wfItem-id-".$this->item->id, $this->item);
}
}
return $this->item;
}
if($name == "changer") {
$user = mfValuecache::get("Worker-id-".$this->changed);
$user = mfValuecache::singleton()->get("Worker-id-".$this->changed);
if($user) {
$this->changer = $user;
return $this->changer;
@@ -146,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::set("Worker-id-".$this->changed, $this->changer);
mfValuecache::singleton()->set("Worker-id-".$this->changed, $this->changer);
}
return $this->changer;
} else {