Creating a store by reference cache

In this post under JCache, I will explain with example how to create store by reference cache. We create a store by reference cache by calling “setStoreByValue” available in “MutableConfiguration” and we need to pass “false” as method argument. Below is the complete main code for your reference. Main Class 1 package defaultPackage; 2 3…… Continue reading Creating a store by reference cache

Creating a store by value cache

In this post under JCache, I will explain with example how to create store by value cache. We create a store by value cache by calling “setStoreByValue” available in “MutableConfiguration” and we need to pass “true” as method argument. Below is the complete main code for your reference. Main Class 1 package defaultPackage; 2 3…… Continue reading Creating a store by value cache

JCache AccessedExpiryPolicy Example

In this post under JCache, I will explain with example the purpose of “AccessedExpiryPolicy” and how to use it AccessedExpiryPolicy is an expiry policy used to inform cache to remove entries which has exceeded its presence based on last accessed. Access involves creation and access of cache entries but not update. Below the main code…… Continue reading JCache AccessedExpiryPolicy Example

JCache EternalExpiryPolicy Example

This post explains EternalExpiryPolicy with simple example. EternalExpiryPolicy is an expiry policy used to inform cache to never remove entries in the cache. Below is an example of how to use it. Main Code 1 import java.util.Iterator; 2 3 import javax.cache.Cache; 4 import javax.cache.Cache.Entry; 5 import javax.cache.CacheManager; 6 import javax.cache.Caching; 7 import javax.cache.configuration.Factory; 8 import…… Continue reading JCache EternalExpiryPolicy Example

Accessing cache provider’s Cache implementation

This post explains how to access the cache provider’s Cache implementation through java cache api. In all my previous post related to Caching, I gave examples where I was accessing cache provider for caching functionality through the Java Cache API. The java cache api is set of specifications, which are implemented by cache providers and…… Continue reading Accessing cache provider’s Cache implementation

Listening to Cache Entry Expired events

Whenever a Cache entry is expired, an event (i.e., CacheEntryEvent) is generated. In this post under JCache, I will show with an example how to create a listener to listen for those events and respond. We have to create a listener class which implements the javax.cache.event.CacheEntryExpiredListener interface as shown below import java.util.Iterator; import javax.cache.event.CacheEntryEvent; import…… Continue reading Listening to Cache Entry Expired events

Listening to Cache Entry Update events

Whenever a Cache entry is updated, an event (i.e., CacheEntryEvent) is generated. In this post under JCache, I will show with an example how to create a listener to listen for those events and respond. We have to create a listener class which implements the javax.cache.event.CacheEntryUpdatedListener interface as shown below import java.util.Iterator; import javax.cache.event.CacheEntryEvent; import…… Continue reading Listening to Cache Entry Update events

Listening to Cache Entry Removed events

Whenever a Cache entry is removed, an event (i.e., CacheEntryEvent) is generated. In this post under JCache, I will show with an example how to create a listener to listen for those events and respond. We have to create a listener class which implements the javax.cache.event.CacheEntryRemovedListener interface as shown below import java.util.Iterator; import javax.cache.event.CacheEntryEvent; import…… Continue reading Listening to Cache Entry Removed events

Listening to Cache Entry Created events

Whenever a new Cache entry is created, an event (i.e., CacheEntryEvent) is generated. In this post under JCache, I will show with an example how to create a listener to listen for those events and respond. We have to create a listener class which implements the javax.cache.event.CacheEntryCreatedListener interface as shown below import java.util.Iterator; import javax.cache.event.CacheEntryCreatedListener;…… Continue reading Listening to Cache Entry Created events