hsntngr
120
1
Laravel

Is Cache class serialize the collection when it stored ?

Posted 9 months ago by hsntngr

I'm trying to cache my posts first time in laravel and I wanna ask something. Is laravel cache class serialize the collectin ? Or we have to serialize returning collection ?

$post_article = \Cache::remember("posts.$post->id." . app()->getLocale(), $minutes = "720", function () use ($post) {
            if (\Cache::has("posts.$post->id"))
                return \Cache::get("posts.$post->id." . app()->getLocale());
            else
                return PostTranslation::getTransArticle($post->id, "review", "published")
                    ?? trans("posts.noDataAboutPost");
        });
``

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.