简体   繁体   中英

ehcache cache “streams” of data

I want to cache the response to image requests. The images are the results of dynamic resizing of a larger image.

I am using ehcache already for some caching. I would like to use it here.

I don't want ehcache to keep the resized image in memory; neither when cached or when being read in.

How do I make ehcache only store on disk (no memory storage)? I don't need it read into memory so how would I get an InputStream from ehcache?

There doesn't seem to be a way. I decided to store the information in a File and keep a reference to that File in the Element you give ehcache. Then I registered an event listener with the Cache that gets notified when the cache entry is being removed. On removal I delete the temp file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM