Laravel cache. The default format is File Cache. Therefore, when writing business code, you need to perform ifelse in the Controller to determine whether to first access the cache, the cache does not access the database again, or Laravel already has a default method, and you will first access the cache, the cache does not automatically remove shards... laravel cache. The default format is File Cache.
Therefore, when writing business code, you need to make if else in the Controller to determine that the cache is accessed first, and the cache does not access the database again,
Or does Laravel already have a default access method. Will it access the cache first, and the cache will not automatically access the database?
If laravel already defines,
So what is the cache policy defined by it: When to generate the cache and how long the cache will be stored?
Reply content:
Laravel cache. The default format is File Cache.
Therefore, when writing business code, you need to make if else in the Controller to determine that the cache is accessed first, and the cache does not access the database again,
Or does Laravel already have a default access method. Will it access the cache first, and the cache will not automatically access the database?
If laravel already defines,
So what is the cache policy defined by it: When to generate the cache and how long the cache will be stored?
UseCache: rememberMethod. If the cache does not exist, access the database and cache it.
$ Value = Cache: remember ('users', $ minutes, function () {return DB: table ('users')-> get ();});
For more information, see the manual.
When the cache is generated depends on whether the cache is defined and how long the cache is saved depends on the time you set ..