Laravel Classroom image

Anil  Bist / 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.

 
 
 
image
Anil  Bist

Skills    Laravel

Qualifications :- High School - SLV, College/University - Graphic Era Deemed Univ University,
Location :-Dehradun,Dehradun,Uttarakhand,India
Description:-

I started my Professional Journey in 2006 with one of the Web Development Company in Bangalore and my 1st framework was "Ruby on Rail" as Web development and delivered around 5+ Projects using this platform. Then came another dimension as JEE/Sturst framework, Gradually I realized that I want to build something on my own and give my passion and energy on creating something different a
Explore

 

  Students (0)