Cache Attribute #41834
Unanswered
vmiguellima
asked this question in
Q&A
Cache Attribute
#41834
Replies: 1 comment
-
@vmiguellima and for those who are looking to find the answer of what I have set up a quick test: public function foo(): Attribute
{
logger()->debug('here 111');
return Attribute::get(function () {
logger()->debug('here 222');
return true;
});
} And when I call
Then, if I append
TL;DR The So I guess if you want to cache the value between different requests, you should go with |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've created an accessor to retrieve the
body
column in html.The attribute is working has expected the only thing that is not working, is caching.
Then I call
$article->html
where needed.But the subsequent calls take as long as the first one.
I'm I doing something wrong? Should I use
Cache::remember
instead? Like this:Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions