'Hazelcast, check if particular key is available in hazel cast map which is configured with mapLoader(read through)

We have implemented read-through using MapLoader with load key functionality which loads specific keys and value from database to Hazelcast map as a part of read-through. My question is if We want check if particular key is available in hazelcast map, how can I achieve that without read-through?

we tried using IMap.contains(key), but Hazelcast performs read-through and loads the data via MapLoader when key is not available. which we do not want.



Solution 1:[1]

You can do IMap.getEntryView(key), which doesn't invoke read-through.

If you're on a newer version of Hazelcast and have SQL, you can also do:

SELECT * FROM map WHERE __key LIKE 'key%'

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Neil Stevenson