fix(memdb): expire semantics + Boost 1.83 portability + backlog & test harness

- expire 改为 update+refresh_ttl:键不存在返回 false,与 del/update 约定一致
- _require_string 适配 Boost 1.83(boost::json::string 已非 std::string)
- 新增 --backlog(默认 128,libmsg 默认 10 短连接突刺易丢连接)
- Makefile 补 HOST/PORT 默认值,test-memdb 用 PID 文件替代失效的 kill %1
- 补测试:复制构造/源销毁后副本有效/refresh 延长 TTL/expire 不存在键
This commit is contained in:
qing committed 2026-08-17 14:29:41 +00:00
1 parent 207137c0dd
commit a833cd0d5f
6 files changed
+79 -23

No files matched your search

+2 -1
View File
@@ -21,7 +21,7 @@ Memdb<std::string, std::string> (libmemdb 模板:LRU 链表 + 哈希索
| `update` | `key`, `value`, `refresh_ttl?` | `true/false` | 更新值,可选刷新 TTL |
| `exists` | `key` | `true/false` | 键是否存在 |
| `size` | — | `int` | 当前条目数 |
| `expire` | `key`, `value` | `true/false` | 更新值并重置 TTL(del + set) |
| `expire` | `key`, `value` | `true/false` | 更新已有键的值并重置 TTL(键不存在返回 false) |
| `show` | — | `[{key,value},...]` | 导出所有条目 |
## 配置
@@ -34,6 +34,7 @@ Memdb<std::string, std::string> (libmemdb 模板:LRU 链表 + 哈希索
| `listen_port` | `8011` | 监听端口 |
| `workers` | `4` | 线程池大小 |
| `max_time` | `600` | 默认 TTL(秒),10 分钟 |
| `backlog` | `128` | listen() backlog(libmsg 默认 10,短连接突刺易丢连接) |
## 构建与运行