I need to cache with Hazelcast some values from the database that are used in a Java project. The logic is to check if the cache is empty, then populate it by calling a dao method; otherwise, return the object from cache.
I'm completely new to Hazelcast and feel confused about configuring a map in the xml file: it can either be included in the hazelcast element, case in which TTL and other useful attributes can be defined or it can be defined outside the hazelcast element, using a reference to it, case in which the attributes cannot be used.
I don't understand why this syntactic difference for the same XML element. The project I'm working on will use a hazelcast instance bean created in another project and if I define the maps outside it, I cannot configure anything.
You can just call this method on that map:
V put(K key, V value, long ttl, TimeUnit timeunit);
You don't need to configure anything on the map itself.