📜 ⬆️ ⬇️

Distributed ehcache cache system for applications of any level

Today I would like to tell you about one interesting project that will be useful for you when designing and implementing complex web applications on the Java platform. This is ehcache , the universal distributed caching system for Java applications and servlets. This is an unusually small application (honestly, such a system level, several hundred Kb in size is a rarity, at the same time of high quality), which implements both a dynamic cache (in RAM) and a disk cache, originally designed for working with large-volume caches. (order of gigabytes) and in distributed systems.



ehcache can implement several different caching strategies, for example, LFR (caching based on frequency of use) or FIFO, and you can control the cache at the level of individual objects (by specifying the invalidation scheme of objects in the cache - by time of life or idle time). By the way, it was not without standards support - the application supports the standard cache protocol - JSR107 JCACHE.
')
Of course, you cannot immediately write an application for all occasions, so the ehcache developers chose a different way, providing simple extensibility of their offspring and some of the functions are implemented through third-party components (for example, distributed caches), so you can be sure that that integration will be fairly simple, flexible and transparent.

One of the unique features of ehcache is the “persistent cache”, which allows you to store the state of objects even after restarting the virtual java-machine. In addition, the caching system supports the JMX management console, which allows you to seamlessly integrate it into the control system of any application using only standard protocols and features. It is precisely these, seemingly not the most essential functions or standards, that distinguish just applications, developments aimed at satisfying, albeit qualitative, but specific tasks, often a specific developer or application, from truly universal and ready for use in enterprise-level applications. .

Distributed caching can be used to provide work on a cluster or in other distributed schemes, using the built-in (since version 1.2) RMI mechanism based on the TCP protocol (yes, not UDP, this is specifically mentioned in the documentation). Synchronization and / or replication of caches between nodes can be both general and local, for individual caches according to their own scheme, asynchronous or synchronous. By the way, for most of the functionality of the application that uses the cache, absolutely nothing is needed, it all depends on only one configuration XML file.

Yes, the cache can be as an independent unit in the application, and interacts with other popular frameworks, in particular, with the layer for working with Hibernate databases.

You can tell a lot more about the project, clarify that it is well documented, tested and tested under heavy loads and various tests, it can work with web applications on Tomcat or other application servers, as well as interact (or is part of) already known and Proven high-level projects: Alfresco (corporate content management system), Cocoon web framework, Spring, Hibernate. But the best thing is to go to the developers' site, download the distribution kit, the size of which is just as funny as it is today, read the documentation or view the source code and start thinking - how can I apply new features and significantly improve the performance of my application? I am sure you will succeed!

Source: https://habr.com/ru/post/25140/


All Articles