[ENTITY][Note][CACHE] Store lists as lists in the cache

This commit is contained in:
Hugo Sales 2021-12-30 17:45:27 +00:00
parent 2e0bfc0bcd
commit 5f4968ac05
Signed by untrusted user: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0

View File

@ -281,7 +281,7 @@ class Note extends Entity
public function getAttachments(): array
{
return Cache::get('note-attachments-' . $this->id, function () {
return Cache::getList('note-attachments-' . $this->id, function () {
return DB::dql(
<<<'EOF'
select att from attachment att
@ -295,7 +295,7 @@ class Note extends Entity
public function getAttachmentsWithTitle(): array
{
return Cache::get('note-attachments-with-title-' . $this->id, function () {
return Cache::getList('note-attachments-with-title-' . $this->id, function () {
$from_db = DB::dql(
<<<'EOF'
select att, atn.title
@ -315,7 +315,7 @@ class Note extends Entity
public function getLinks(): array
{
return Cache::get('note-links-' . $this->id, function () {
return Cache::getList('note-links-' . $this->id, function () {
return DB::dql(
<<<'EOF'
select l from link l
@ -329,7 +329,7 @@ class Note extends Entity
public function getTags(): array
{
return Cache::get('note-tags-' . $this->getId(), fn () => DB::findBy('note_tag', ['note_id' => $this->getId()]));
return Cache::getList('note-tags-' . $this->getId(), fn () => DB::findBy('note_tag', ['note_id' => $this->getId()]));
}
/**