Posts

Showing posts from January, 2018

EhCache3 as JCache (JSR-107) Implementation with Cache Statistics

Image
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. Read my other post to learn InMemory Caching using EhCache3 . There are many ways to implement cache in java based applications, starting from very simple Map based caching to Apache Common JCS , EhCache , Apache Ignite , Hazelcast , Oracle Coherence and many more. With so many implementations available, question is which one we should go for?  If you have to choose one from multiple options best bet is to look for standard. Standard because many people have put their mind together in it, better support, examples and guide available for reference plus expect that further upgrades/changes will not breaking changes. So for InMemory cache Standard Specification is JSR-107 .  You can read about it in more detail at JSR 107: JCACHE - Java Temporary Caching API . JCache specifies API

EhCache3 In Memory Caching for Performance Improvement

Image
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 based caching to Apache Common JCS , EhCache , Apache Ignite , Hazelcast , Oracle Coherence and many more. Each of them have pros and cons. I will show how to use EhCache for caching implementation EhCache3 Implementation For this example you need to have following jars in the class path - <dependency> <groupId>org.ehcache</groupId> <artifactId>ehcache</artifactId> <version>3.4.0</version> </dependency> <dependency> <!-- We need this because ehcache uses slf4j for logging --> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.7.25</version>

Syntax highlighting and formating source code in blog

Image
There are many very enthusiastic bloggers and writers in many fields. I am writing this blog for blogger who write about Information Technology, source code, algorithm. When a blogger is writing I am sure he has good enough knowledge about the subject and write very good quality content on it. Along with content quality, presentation and formatting of the content is very important so that reader can easily read and understand the idea. When I started writing technical blogs involving source code, it was very challenging to present source code on the blog which easily readable with all standard code syntax highlighting. Without formatting, indentation and keyword highlighting its very difficult for a programmer / coder to understand the code logic. Code would need to copy paste code from blog to IDE to see it properly and understand. While searching I found some fantastic and very easy to use tool or ways to highlight source code in your blogs. Below are detail about the tools I li