From ca28f9cfcbff0fbdb2afe96f1427245f83db7c47 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 1 Dec 2016 09:25:53 -0500 Subject: Allow objects to opt out of gc, don't gc accounts with users logged in Also store cached state with the field by using Serialize::Storage for field storage --- modules/database/sql.cpp | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) (limited to 'modules/database/sql.cpp') diff --git a/modules/database/sql.cpp b/modules/database/sql.cpp index 7ca4eb6d7..1739f168d 100644 --- a/modules/database/sql.cpp +++ b/modules/database/sql.cpp @@ -30,21 +30,6 @@ class DBSQL : public Module, public Pipe bool inited = false; Anope::string prefix; ServiceReference SQL; - std::unordered_multimap cache; - - void CacheMiss(Serialize::Object *object, Serialize::FieldBase *field) - { - cache.insert(std::make_pair(object, field)); - } - - bool IsCacheMiss(Serialize::Object *object, Serialize::FieldBase *field) - { - auto range = cache.equal_range(object); - for (auto it = range.first; it != range.second; ++it) - if (it->second == field) - return true; - return false; - } Result Run(const Query &query) { @@ -91,8 +76,7 @@ class DBSQL : public Module, public Pipe void OnNotify() override { Commit(); - Serialize::Clear(); - cache.clear(); + Serialize::GC(); } void OnReload(Configuration::Conf *conf) override @@ -208,14 +192,8 @@ class DBSQL : public Module, public Pipe { SQL::Result::Value v; - if (IsCacheMiss(object, field)) - return EVENT_CONTINUE; - if (!GetValue(object, field, v)) - { - CacheMiss(object, field); return EVENT_CONTINUE; - } value = v.value; return EVENT_ALLOW; -- cgit