Lumen File Cache Driver

- 1 answer

I'm in Lumen, inside a Controller, and I would like to cache a computation's result in a simple and easy way, without using database or external services, so I was looking for save the cache in the filesystem. In Laravel's documentation there is cited the file driver:

By default, Laravel is configured to use the file cache driver, which stores the serialized, cached objects in the filesystem.

And I can see it, configured as Default Cache Store, inside config/cache.php.

In Lumen's documentation i can't see anything about the file driver and I find nothing like the file cache.php inside Lumen installation.

So my question is if I can use the file cache driver in Lumen (by setting CACHE_DRIVER=file) or if it is discouraged, not supported, not implemented or something else?



In Lumen in .env.example you have by default:


So all you need is to change filename from .env.example to .env and set


If you read Caching in Lumen you'll see in example:

$value = Cache::store('file')->get('foo');

so file driver is supported by Lumen.

If you also read Lumen Configuration you can read here that you can copy configuration files you need (in case you need them) and load them manually. You can see default Luman cache config file here: