从 Laravel 5.8 开始,传递到缓存驱动的表示缓存有效期(TTL)的整型数据单位将会从分钟调整为秒,秒级缓存会使得开发者得以对缓存周期进行更加细粒度的控制,并且符合 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.
事物的有效期(TTL)指的是其从保存到失效之间的时间量,TTL的单位通常被定义为秒级,或者一个 DateIntervel
对象。
从 Laravel 5.0 到当前的稳定版本 Laravel 5.7,当你传整数到缓存存储 操作,例如 put()
和 remember()
,持续时间都以分钟表示:
Cache::remember('active-posts', 5, function () {
return Post::acti