Laravel Classroom image

Yasar  Khan / Professional / Web Technology

 
To post your Question Join Classroom
 
Lesson Topics's No:-  First|1 | 2 | 3 | 4|Last
Lessons:-Caching

17.2 Setting values
You can use the put() or forever() methods to store data in the Cache.
The put() method allows you to store a value for a set period of time, let’s have a look at a code
sample..
1 <?php
2
3 $data = 'complicated_generated_data';
4 Cache::put('mydata', $data, 10);
Let’s pretend that $data wasn’t just an assigned string, but the result of a complicated algorithm
that would take some time to process. We don’t want to process this data all the time, so we
keep it in the cache.
The first parameter to the method is the key, a string used to identify the cached data. The second
parameter is the data itself, and the third is the amount of time in minutes to cache to the data.
The forever() method takes only the first two parameters, and acts exactly as the name implies.
The data is cached forever.

 
 
 

Yasar  Khan

Skills    Laravel

Qualifications :-
Location :-Dehradun,Dehradun,Uttarakhand,India
Description:- Hi i am yasar working as web developer since last 3 years.
Explore
 

  Students (0)