3

We have an application that processes image data, running on a single machine. The processing is very expensive (10 to 30 seconds), so we cache the resulting files on disk. Those files are also big, so we have to prune the cache when it hits the configurable boundaries. The cached image files themselves are created by a different non-Java process. And there are user actions that may lead to certain cache entries becoming invalid.

Current implementation:

Currently we're using a custom cache manager for that and store some meta data separately in a file system structure.


Requirements for a caching provider:

I've looked into a couple of Java cache solutions, but none seem to match our requirements.

  1. overflow to disk (we cannot keep the entire cache in memory because RAM is very limited)
  2. persistent on shutdown, read on startup (must not be failsafe, but at least best effort)
  3. LRU eviction strategy
  4. size limitation of disk and memory cache by (different) max number of elements
  5. custom cache eviction listeners (to notify a second system)

Here's why the common frameworks don't qualify:

ehcache fails on point (1) and (2) since one cannot have both at the same time

JCS fails on point (5) as it's not possible to react to disk cache eviction events

Guava fails on point (1) as there's no overflow to disk option

Any advice is appreciated.

pandhi
  • 43
  • 4
  • 2
    This is a question for softwarerec, not SO – fge May 20 '15 at 13:24
  • Thanks for your suggestion. I'm not looking for separate software though, but a library that can be embedded. Is that more appropriate in softwarerec as well? Content seems to be more focused on end user software there. Questions like "framework X vs framework Y" are quite common on SO, are they not? – pandhi May 20 '15 at 14:22

1 Answers1

3

Take a look at Infinispan. I think it covers all of your requirements.

Shailendra
  • 8,874
  • 2
  • 28
  • 37