Cache TTL Change Coming to Laravel 5.8

Cache TTL Change Coming to Laravel 5.8

Starting in Laravel 5.8, the time to live (TTL) used when passing an integer to cache drivers will be in ‚ÄĆseconds instead of minutes. Caching in seconds gives users more granular control over cache duration, and will conform with PSR-16: The Time To Live (TTL) of an item is the amount of time between when that item is stored, and it is considered stale. The TTL is normally defined by an integer representing time in seconds, or a DateInterval object. From Laravel 5.0 to the current stable Laravel 5.7, when you pass an integer to cache storage operations like put() and remember(), the duration is represented in minutes:

Cache::remember('active-posts', 5, function () { return Post::active()->get(); });

0 Comments

Leave a reply

your email address will not be published. required fields are marked *

Categores Themes

Featured Themes