Laravel cache ttl – how to set cache for day

Param ttl is quite confusing in laravel cache. So here how we handle it:

 cache()->set($key, $value, now()->addDay());

So basically we just pass carbon instance and add amount of time we want cache to expire.

Click to rate this post!
[Total: 0 Average: 0]

You May Also Like

About the Author: deniskoronets

Leave a Reply

Your email address will not be published. Required fields are marked *