Setting Up the File Cache Driver

Problem

You want to use the File driver for the Laravel Cache.

You know other caches are more efficient than using the file system, but you want to get going quickly.

Solution

It should be pre-configured.

Laravel's default configuration uses the file cache driver. You can check the configuration by examining app/config/cache.php. Look for the driver setting. It should look like what's below.

'driver' => 'file',

If the setting is anything other than file, you can change it here. Or, if you're using Environment Specific Configurations, you'll want to change this setting in your app/config/{envname}/cache.php file.

Discussion

The file cache driver has some limitations.

Specifically, you cannot use the Cache::increment() and Cache::decrement() methods. And Cache Sections are not supported.

comments powered by Disqus