less duplicated logic in DBKVStore and faster contains method