java - Pick up a cache implementation, or roll your own? -
I am making a Java EE application, and I am at a point where I have concluded that I need cache For my objects.
My current requirements are not more complex than any kind of key-value storage, maybe something that can handle a tree, write a simple custom static / realistic class with one or more maps Will be attractive to But, since there are several such implementations which tend to be more or less like (Coming in the brain), I started thinking that there should be some extra value in using lambachad, rather than just its own implementation.
Therefore, I am asking for ideas about this: Why should I cache my finished data, when I can do my own static data? And on the contrary; Why should I write a static class when I can get a ready cash?
I had good performance with a one-liner in cases of complex object graphs for many people < / P>
New Map Maker () WeakKeys () MakeMap ();
This uses a map, with which it can be used as a cash for complex objects.
Since the keys are weak, and eventually exit the realm, it is unlikely that this will be the cause of memory issues.
So I would say for ordinary cases - do not bother with the "cognitive load" of a distributed cache. Serialization problems, latency etc. You will not want to handle them.
Comments
Post a Comment