I'm working on an app using Play framework 2.6. (launched using sbt, if that matters) I would like to set cache timeouts to a certain limit using configuration, rather than individually for each endpoint.
The old version seems to have had something like this - https://www.playframework.com/documentation/1.2.3/configuration#http
But this doesn't work for my current project. Any pointers?
(Running the app in production mode on my local sets it to: Cache-Control: max-age=0)
Try the following, create your own Adapter Pattern around the Cache API:
Now that you have a
ConfigCacheclass you can inject that where needed...Try it out. Not exact code. I just put some code together without checking. I would say don't use the word 'cache' as a package as I think that's a reserved package name. Let us know how it goes and what your final answer is. ;)