I am a software engineer and blogger. I try to post to my blog whenever I have free time. My passion is to learn new things each day. Yusuf is a DZone MVB and is not an employee of DZone and has posted 12 posts at DZone. You can read more from them at their website. View Full User Profile

Imcache : Stable version 0.1.0 released

  • submit to reddit

Imcache  0.1.0 is released with bunch of new features like CacheIndexes, QueryExecution with criterias and filters, CachePopulator and so on.

Here is a sample query execution code snippet . 

SearchableCache<Integer, Customer> cache = CacheBuilder
   .heapCache().addIndex("age", IndexType.RANGE_INDEX).build();
cache.put(0, createCustomer());
cache.put(1, createCustomer());
cache.put(2, createCustomer());
List<SimpleObject> objects = cache.execute(CacheQuery.newQuery()
   .setCriteria(new BetweenCriteria("age",20,30)
   .or(new ETCriteria("age", 33)))
   .setFilter(new LTFilter("highestPurchase", 3000)));

Before going into detail, here is a quick explanation of the concept used in the snippet.

Criterias are for meeting certain condition for the indexed values.

Filters are for eliminating objects from the result set of the query. 

In this code snippet, we create a searchable cache with a range index on age attribute. We then create random customers and populate the cache. We then create a new query with between criteria and equals to criteria. We also filter the result set with less than filter for highestPurchase attribute.

Maven dependency for imcache is as follows.


We also announce open positions for imcache. If you are interested in, please let us know.

Average: 5 (3 votes)
Published at DZone with permission of Yusuf Aytaş, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)