Reputation: 2344
I am building Java application which uses Play Framework and it is crucial for me to access cached files.
I am looking for a place where Play Framework's cache resides. Is that somewhere on disk, and if yes, where?
Can I access files from it (e.g. from windows explorer) somehow or it is deliberately hidden from users (or maybe encrypted)?
Upvotes: 2
Views: 1554
Reputation: 55569
Play's default cache implementation uses EhCache, which is an in-memory cache. Everything that's cached (should be) serialized as bytes, and stored in memory somewhere. There is no encryption as far as I know. So no, there are no files you can access. And because it's an in-memory cache, its gone as soon as you shut down or restart the server.
As pointed out by @RichDougherty, you can configure EhCache to cache to disk, rather than memory. I dropped this ehcache.xml
into my conf
directory:
<ehcache>
<diskStore path="/home/mz/temp"/>
<defaultCache
maxEntriesLocalHeap="10000"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
maxEntriesLocalDisk="10000000"
diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU">
<persistence strategy="localTempSwap"/>
</defaultCache>
</ehcache>
..Which spits out a binary play.data
file into that directory.
I don't quite understand why you'd want to cache to disk, unless you're really strapped for memory. Disk caching would not be very efficient for a local cache, and would not work in a distributed environment.
Instead of an in-memory or disk cache, you can use another cache plugin like memcached or redis. If you need to access the cache from outside the application in those instances, then you can do so with another implementation. For instance, if you use redis, you can use redis-cli.
Upvotes: 5