integrated object cache into session and added message bus to object_cache and update tests

This commit is contained in:
2026-05-22 15:26:16 +02:00
parent ddf19bbf07
commit 5ec7c13420
8 changed files with 212 additions and 21 deletions
+8 -3
View File
@@ -2,7 +2,9 @@
#include "matador/object/object_cache.hpp"
#include "matador/object/object_resolver.hpp"
#include "matador/utils/identifier.hpp"
#include "matador/utils/message_bus.hpp"
#include "../test/models/person.hpp"
@@ -58,7 +60,8 @@ private:
} // namespace
TEST_CASE("object_cache: acquire_proxy returns the same proxy instance across threads", "[object][cache][threadsafe]") {
matador::object::object_cache cache;
matador::utils::message_bus bus;
matador::object::object_cache cache(bus);
const matador::utils::identifier id{123};
std::atomic_int calls{0};
@@ -89,7 +92,8 @@ TEST_CASE("object_cache: acquire_proxy returns the same proxy instance across th
}
TEST_CASE("object_cache: attach_entity makes is_loaded/get_entity reflect presence", "[object][cache]") {
matador::object::object_cache cache;
matador::utils::message_bus bus;
matador::object::object_cache cache(bus);
const matador::utils::identifier id{42};
REQUIRE_FALSE(cache.is_loaded<person>(id));
@@ -107,7 +111,8 @@ TEST_CASE("object_cache: attach_entity makes is_loaded/get_entity reflect presen
}
TEST_CASE("object_cache: erase invalidates existing proxies", "[object][cache]") {
matador::object::object_cache cache;
matador::utils::message_bus bus;
matador::object::object_cache cache(bus);
const matador::utils::identifier id{9};
std::atomic_int calls{0};