Since come to Beibei, work more and more busy, has not done a day a more, one weeks to do three update is very difficult, ashamed ...
Today we'll take a look at one of the new auxiliary functions in Laravel 5.3: Cache.
This auxiliary function is similar to the other two auxiliary functions: Session and Cookie, they all have three usages: get the value, set the value and return the instance of the corresponding service, take the session as an example:
Session (' ABC ', NULL) gets the value of the ABC and returns NULL if NULL
session ([' ABC ' => ' Laravel College ']) set the value of ABC to Laravel College
Session () Returns an instance of SessionManager
The third usage means that you can use the session ()->all () to replace Session::all ().
In fact, cache this auxiliary function long overdue, Jeffrey Way (laracasts webmaster) has implemented such a function, in order to respond to the voice of the masses, laravel 5.3 to the function into the core library.
As with the session, the cache function also has three different uses:
Cache (' abc ', NULL) gets the cached value of ABC and returns NULL if not
Cache ([' ABC ' => ' Laravel College '], 5) used to set the cached value, valid for 5 minutes
Cache () Returns an instance of CacheManager
The same third usage means you can use a method like cache ()->forever () to replace Cache::forever (), and of course you can invoke many other functions that you can test on your own.