From 89796605c76d3c016fb18ccc81e880ed4447daf1 Mon Sep 17 00:00:00 2001 From: PostmanLinux Date: Mon, 5 Jun 2023 22:53:41 +0800 Subject: [PATCH] [kvdb] improve kvdb cache algo when key was first found (#218) --- src/fdb_kvdb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fdb_kvdb.c b/src/fdb_kvdb.c index b2f0f33..704ff8d 100644 --- a/src/fdb_kvdb.c +++ b/src/fdb_kvdb.c @@ -221,11 +221,11 @@ static void update_kv_cache(fdb_kvdb_t db, const char *name, size_t name_len, ui if (empty_index < FDB_KV_CACHE_TABLE_SIZE) { db->kv_cache_table[empty_index].addr = addr; db->kv_cache_table[empty_index].name_crc = name_crc; - db->kv_cache_table[empty_index].active = 0; + db->kv_cache_table[empty_index].active = FDB_KV_CACHE_TABLE_SIZE; } else if (min_activity_index < FDB_KV_CACHE_TABLE_SIZE) { db->kv_cache_table[min_activity_index].addr = addr; db->kv_cache_table[min_activity_index].name_crc = name_crc; - db->kv_cache_table[min_activity_index].active = 0; + db->kv_cache_table[min_activity_index].active = FDB_KV_CACHE_TABLE_SIZE; } }