EhCache3 In Memory Caching for Performance Improvement
If you are reading this you already know that caching is mechanism to store static data In-Memory for faster access and avoid expensive database calls or any kind of service calls to get the data.
There are many ways to implement cache in java based applications, starting from very simple Map
EhCache3 Implementation
Item Expiry - If entry in the cache meets the expiry condition, it will be evicted (removed) from the cache. To standard type of expiry conditions are Time-To-Live and Time-To-Idle. I will use Time-To-Live
Cache Max Size - Maximum size up to which the cache can grow. The max size constraint can be set by byte size (KB, MB etc) or no on entries in the cache. I will use no of entries.
Person.java
AppCacheManager.java
MainApp.java
Output
Explanation
As always comments and feedback are welcome.
Comments
Post a Comment