Search code examples
hazelcasthazelcast-imap

Hazelcast c++ client, map and TTL


I have an entry (k1, v1) in map with ttl say 60 secs.

If I do map.set(k1, v2), the ttl is not impacted, i.e. the entry will get removed after 60 seconds. However, if I do map.put(k1, v2), the ttl will seize to exist, i.e. entry will not be removed after 60 seconds.

Is this understanding correct? I guess it this way, but could not find it clearly mentioned in documentations.


Solution

  • You are correct. There was a bug for map.put when using configured ttl time. I just submitted the PR for the fix here with the additional tests: https://github.com/hazelcast/hazelcast-cpp-client/pull/164

    We mistakenly sent 0 instead of -1 for the ttl. -1 means to use the configured ttl. This was correct for set API already, the problem was only with the put API.

    Thanks for reporting this.