You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the example here example , if I add a entry using map.put("1", person,1000) (ttl of 1000 seconds ) ,it doesnt seem to work .And always returns an empty value even before ttl.
The text was updated successfully, but these errors were encountered:
Hello @vinod4dev . Time unit of TTL is actually milliseconds, not seconds. In your case, TTL is only 1 second. Probably you try to access the value after it is evicted. There is a mistake in our documentation. I tried below code(ttl is 10 seconds) just to be sure and it worked as expected:
var HazelcastClient = require('hazelcast-client').Client;
var Config = require('hazelcast-client').Config;
var config = new Config.ClientConfig();
config.networkConfig.addresses = [{host: '127.0.0.1', port: '5701'}];
var map = {};
HazelcastClient
.newHazelcastClient(config)
.then(function (hazelcastClient) {
map = hazelcastClient.getMap("persons");
insertPerson(map);
readPerson(map);
});
var printValue = function (text, value) {
console.log(text + JSON.stringify(value));
};
var insertPerson = function (map) {
var person = {
firstName: "Joe",
lastName: "Doe",
age: 42
};
map.put(1, person, 10000).then(function (previousValue) {
printValue("Previous value: ", previousValue);
});
};
var readPerson = function (map) {
map.get(1).then(function (value) {
printValue("Value for key=1: ", value);
})
};
I opened a new issue for documentation fix: #94
I am closing this issue. Feel free to reopen it if you still have problems.
Thank you for trying hazelcast node.js client.
In the example here example , if I add a entry using
map.put("1", person,1000)
(ttl of 1000 seconds ) ,it doesnt seem to work .And always returns an empty value even before ttl.The text was updated successfully, but these errors were encountered: