c - 在 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=%d\n", err.code);
}
as_operations_destroy(&ops);
return err.code;
}
上面的代码旨在使用指定的值重置 ttl,但它只是将其重置为默认配置 ttl。我想用不同的值设置 ttl,而不是默认配置。任何人都可以帮助它。
谢谢
解决方案
Aerospike 服务器在每次写入操作(包括触摸)后重置记录的 ttl。如果未为写入操作设置所需的 ttl,则使用服务器默认 ttl。
完成任务的唯一方法是在对该记录的每个写入操作上设置相同的 ttl。在触摸操作上设置 ttl,然后在地图移除操作上再次设置相同的 ttl。
推荐阅读
- assembly - 乱序执行如何与条件指令一起工作,例如:英特尔中的 CMOVcc 或 ARM 中的 ADDNE(加不等于)
- postgresql - 解释结果中的“重新检查条件”是什么意思?
- ruby - Knight's Travail:递归解决方案
- php - 基于多维数组级别创建数组
- python - 如何编辑非标准 JSON 文件或正确访问其值
- c++ - Boost.Python ArgumentError 与类指针不匹配 C++ 签名
- hex - 在 Elixir 中将十进制整数转换为十六进制
- r - 在 dplyr 中是否有更简洁的方法来过滤包含大于或小于数字的列?
- wordpress - 是否可以在 GitHub 中托管我的 WordPress 插件?
- android - android.permission.WRITE_SETTINGS 不能在清单中使用