Description
Description
While running into performance issues on my machine with requests taking up to seconds, i noticed that API Platform decides between 2 cache methods (array/file) based on the APP_DEBUG setting which was quite confusing. I get that the default value for using laravels cache setting CACHE_STORE
is file
and that in development instances you wouldn't wanna cache at all. So i can also see why you would check for another .env setting (like DEBUG). However i couldn't find that in the documentation (maybe i missed it). So i'd like to propose the following changes:
-
Document that the
DEBUG
setting changes the caching strategy for api platform (or switch to a config setting or toENVIRONMENT
(production/local) setting or whatever - altough i would prefer something like using theENVIRONMENT
setting, ultimately i think it does not really matter as long as it is in the docs) -
Reagardless of the Above, keep
array
in "debug" cases but use theCACHE_STORE
setting which comes with laravel for production e.g non debug. It defaults to file anyway and allows more control with no overhead. -
Since that cache is stored "forever" when it is first accessed (Metadata etc.. does not change on production environments), it could be cool/useful to hook into the Optimze command of laravel (described here) and "warm up" the cache with that data. I think that would be pretty neat.
Let me know what you think about that, i will happily submit a PR :)