Laravel - Cache - Storing Items In The Cache
You may use the put
method on the Cache
facade to store items in the cache:
Cache::put('key', 'value', $seconds = 10);
If the storage time is not passed to the put
method, the item will be stored indefinitely:
Cache::put('key', 'value');
Instead of passing the number of seconds as an integer, you may also pass a DateTime
instance representing the desired expiration time of the cached item:
Cache::put('key', 'value', now()->addMinutes(10));