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

+7 -5
View File
@@ -8,6 +8,9 @@ BUILD = build
TARGET = $(BUILD)/memdb
SRC = src/memdb.cpp
HOST ?= 127.0.0.1
PORT ?= 8011
all: $(TARGET)
$(BUILD):
@@ -37,13 +40,12 @@ test-libmemdb: $(TEST_LIBMEMDB)
test-memdb: $(TARGET)
@echo "Starting memdb server..."
./$(TARGET) --host $(HOST) --port $(PORT) --workers 2 --max-time 10 &
@./$(TARGET) --host $(HOST) --port $(PORT) --workers 2 --max-time 10 >/dev/null 2>&1 & echo $$! > .memdb.pid
@sleep 1
-python3 test_memdb.py $(HOST) $(PORT); EXIT=$$?
@kill %1 2>/dev/null; wait %1 2>/dev/null
@exit $$EXIT
@python3 test_memdb.py $(HOST) $(PORT); EXIT=$$?; \
kill $$(cat .memdb.pid) 2>/dev/null; rm -f .memdb.pid; exit $$EXIT
clean:
rm -f $(TARGET) $(TEST_LIBMEMDB)
rm -f $(TARGET) $(TEST_LIBMEMDB) .memdb.pid
.PHONY: all clean test test-libmemdb test-memdb