在Aerospike中,使用C客户端在ops中指定ttl的触摸操作没有重置到指定值.它重置为默认配置值


as_status update_record_ttl(int ttl, const char *key) {
as_operations ops;
as_operations_inita(&ops, 1);
as_operations_add_touch(&ops);
ops.ttl = ttl;
as_error err;
as_key record_key;
as_key_init_str(&record_key, g_namespace, g_set, key);
if (aerospike_key_operate(&g_as, &err, NULL, &g_key, &ops, NULL) !=
AEROSPIKE_OK) {
fprintf(stderr, "TTL update failed!! rc=%dn", err.code);
}
as_operations_destroy(&ops);
return err.code;
}

上面的代码是为了用指定的值重置ttl,但它只是重置它的默认配置ttl。我想将ttl设置为不同的值,而不是默认配置。有谁能帮帮忙吗?

感谢

Aerospike服务器在每次写操作(包括触摸)后重置记录的ttl。

如果写操作没有设置所需的ttl,则使用服务器的默认ttl。

完成任务的唯一方法是为该记录的每次写操作设置相同的ttl。在触摸操作上设置生存时间,然后在地图移除操作上再次设置相同的生存时间。

最新更新