Expiring Hash Map

I am creating a java service where I am looking to create a Hash Map. However my requirement is to expire an object in that Map if not used for a while. I know there is ExpiringMap available in apache guava which I can use. Any other option to use in this situations?

You can make use of Ehcache that comes with Integration Server. You do not need any terracotta license just to make use of basic caching features without distributed caching.

You can achieve the expiry feature you are looking for in Ehcache. Please refer to below link which explains on how to programmatically create and use caches without the need of XML configuration file

http://www.ehcache.org/documentation/2.8/code-samples.html#adding-and-removing-caches-programmatically

I need to maintain many hash maps is my solution. Means my requirement do not allow me to uses singleton. Does this mean I need to create separate cache dynamically on demand?

Yes, Farid. You have to create cache dynamically on demand. You have to treat the cache creation as hashmap creation and make use of it.