You must have a JSR 107 cache implementation (aka JCache) available in your Play application to use Play WS’s cache facility. Play comes with an implementation that uses ehcache, so the easiest implementation is to add the following to build.sbt:

libraryDependencies += ws
libraryDependencies += ehcache

And enable the HTTP cache by adding the following to application.conf

play.ws.cache.enabled=true

If no JCache implementation is found, then Play WS will use an HTTP Cache with a stub cache that does not store anything.

By default, Play WS does not cache HTTP responses when no explicit cache information is passed in. However, HTTP caching does have an option to cache pages based off heuristics so that you can cache responses even without co-operation from the remote server.

Cache size is limited by the underlying cache implementation. Play WS will create a generic cache if no cache was found, but you should bound the cache explicitly, as JCache does not provide many options.

NOTE: If you do not limit the HTTP cache or expire elements in the cache, then you may cause the JVM to run out of memory.

In ehcache, you can specify an existing cache by specifying CacheManager URI explicitly, which is used in cachingProvider.getCacheManager(uri, environment.classLoader):