I have a problem in getting cardinality service in hazelcast. In following code, I add some visitor to cardinality estimator. messageID is unique. In test environment that filled by 5K unique item by this code.
public void AppendVisitor(String messageID, String visitor) {
CardinalityEstimator cs = this.hazelcast.getCardinalityEstimator(messageID);
cs.add(visitor);
this.viewsList.putIfAbsent(messageID, Long.valueOf(System.currentTimeMillis() / 1000L));
}
In expiration of viewsList in another class I write listener code. The entry event key was messageID in previous code. But when call this function, visit is 0. Seems it get another object that is empty.
@Override
public void entryEvicted(EntryEvent<String, Long> entryEvent) {
long visit = hazelcast.getCardinalityEstimator(messageID).estimate();
}