diff --git a/shared_realm.cpp b/shared_realm.cpp index 10c09f6c..a7269591 100644 --- a/shared_realm.cpp +++ b/shared_realm.cpp @@ -395,3 +395,10 @@ void RealmCache::cache_realm(SharedRealm &realm, std::thread::id thread_id) } } +void RealmCache::clear() +{ + std::lock_guard lock(m_mutex); + + m_cache.clear(); +} + diff --git a/shared_realm.hpp b/shared_realm.hpp index e2640386..af8b774a 100644 --- a/shared_realm.hpp +++ b/shared_realm.hpp @@ -117,13 +117,13 @@ namespace realm { Group *m_group; static std::mutex s_init_mutex; - static RealmCache s_global_cache; public: ExternalNotificationFunction m_external_notifier; // FIXME private Group *read_group(); + static RealmCache s_global_cache; }; class RealmCache @@ -133,6 +133,7 @@ namespace realm { SharedRealm get_any_realm(const std::string &path); void remove(const std::string &path, std::thread::id thread_id); void cache_realm(SharedRealm &realm, std::thread::id thread_id = std::this_thread::get_id()); + void clear(); private: std::map> m_cache;