mirror of
https://github.com/status-im/realm-js.git
synced 2025-02-19 18:08:30 +00:00
Add the ability to bypass the Realm cache entirely
This commit is contained in:
parent
3f226cf342
commit
65e1eb5d08
@ -90,8 +90,8 @@ Group *Realm::read_group()
|
||||
|
||||
SharedRealm Realm::get_shared_realm(Config config)
|
||||
{
|
||||
SharedRealm realm = s_global_cache.get_realm(config.path);
|
||||
if (realm) {
|
||||
if (config.cache) {
|
||||
if (SharedRealm realm = s_global_cache.get_realm(config.path)) {
|
||||
if (realm->config().read_only != config.read_only) {
|
||||
throw MismatchedConfigException("Realm at path already opened with different read permissions.");
|
||||
}
|
||||
@ -108,13 +108,13 @@ SharedRealm Realm::get_shared_realm(Config config)
|
||||
/*if (realm->config().schema != config.schema) {
|
||||
throw MismatchedConfigException("Realm at path already opened with different schema");
|
||||
}*/
|
||||
|
||||
realm->m_config.migration_function = config.migration_function;
|
||||
|
||||
return realm;
|
||||
}
|
||||
}
|
||||
|
||||
realm = SharedRealm(new Realm(std::move(config)));
|
||||
SharedRealm realm(new Realm(std::move(config)));
|
||||
|
||||
// we want to ensure we are only initializing a single realm at a time
|
||||
static std::mutex s_init_mutex;
|
||||
|
Loading…
x
Reference in New Issue
Block a user