I'm doing a Java EE application, and I'm at a point where I've concluded that I need a cache for my objects.
My current requirements aren't much more complicated than some kind of key-value storage, possibly something that can handle a tree. It would be tempting to write a simple custom static/singleton class containing one or more maps. But, since there are several implementations that do more or less just like this (Memcached comes to mind), I began wondering that there must be some added value into using Memcached, instead of just my own implementation.
So, I'm asking for thoughts about this: why should I pick up a ready-made cache, when I can do my own static data? And vice versa; why should I write a static class, when I can pick up a ready-made cache?
There are many cache implementations, both open source and commercial. There are many issues regarding writing a correct cache - time to leave of the objects, eviction policies, persistence, memory management, and more, so I wouldn't start one of my own (why to reinvent the wheel?)
Take a look at one of the following implementations:
See more at http://java-source.net/open-source/cache-solutions
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With