9#ifndef SKYWAY_ROOM_ROOM_DOMAIN_CACHE_MANAGER_HPP
10#define SKYWAY_ROOM_ROOM_DOMAIN_CACHE_MANAGER_HPP
14#include <unordered_map>
16#include "skyway/room/interface/room_domain_cache_manager.hpp"
23class RoomDomainCacheManager :
public interface::RoomDomainCacheManager<T> {
25 ~RoomDomainCacheManager();
26 void CacheRoomDomainInstance(
const std::string&
id, std::shared_ptr<T> instance)
override;
27 std::shared_ptr<T> FindCachedRoomDomainInstance(
const std::string&
id)
override;
28 void RemoveCachedRoomDomainInstance(
const std::string&
id)
override;
31 void ClearExpiredDeletedInstanceIds();
33 std::unordered_map<std::string, std::shared_ptr<T>> cached_room_domain_instances_;
38 std::unordered_map<std::string, std::chrono::steady_clock::time_point>
39 deleted_room_domain_instance_ids_by_id_;
40 std::multimap<std::chrono::steady_clock::time_point, std::string>
41 deleted_room_domain_instance_ids_by_time_;
44 friend class RoomDomainCacheManagerTest;