当您指定
expires_in: 21.days
在缓存时,告诉底层缓存存储存储给定密钥的数据(这里
token
)在21天内,21天后它将过期,这意味着数据不再可用于您使用的give密钥
exist?
方法检查此。
Rails.cache.exist?(token) # => true (data is available and you read)
Rails.cache.exist?(token) # => false (cache is expired, data is not available)