lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi] [PATCH 4/5] Remove old caching from DBDictionary.


From: Vaclav Slavik
Subject: [lmi] [PATCH 4/5] Remove old caching from DBDictionary.
Date: Fri, 15 Jun 2012 18:19:32 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:13.0) Gecko/20120601 Thunderbird/13.0

---
 dbdict.cpp |   23 -----------------------
 dbdict.hpp |    4 ----
 2 files changed, 27 deletions(-)

diff --git a/dbdict.cpp b/dbdict.cpp
index 72406d1..119f124 100644
--- a/dbdict.cpp
+++ b/dbdict.cpp
@@ -53,8 +53,6 @@
 
 template class xml_serializable<DBDictionary>;
 
-std::string DBDictionary::cached_filename_;
-
 namespace xml_serialize
 {
 template<> struct xml_io<database_entity>
@@ -405,41 +403,21 @@ void DBDictionary::ascribe_members()
 }
 
 /// Read and cache a database file.
-///
-/// Perform the expensive operation of reading the dictionary from
-/// file only if the cached file name doesn't match the new filename.
 
 void DBDictionary::Init(std::string const& filename)
 {
     LMI_ASSERT(!filename.empty());
-    if(filename == cached_filename_)
-        {
-        return;
-        }
 
     try
         {
-        cached_filename_ = filename;
         load(filename);
         }
     catch(...)
         {
-        InvalidateCache();
         report_exception();
         }
 }
 
-/// Cause next Init() call to read from file instead of using cache.
-///
-/// The implementation simply sets the cached filename to an empty
-/// string, which is its initial value upon (static) construction and
-/// cannot validly name any file.
-
-void DBDictionary::InvalidateCache()
-{
-    cached_filename_.clear();
-}
-
 /// Save file, invalidating the cache.
 ///
 /// If data are modified (by the GUI product editor) and saved under a
@@ -449,7 +427,6 @@ void DBDictionary::InvalidateCache()
 
 void DBDictionary::WriteDB(std::string const& filename) const
 {
-    InvalidateCache();
     save(filename);
 }
 
diff --git a/dbdict.hpp b/dbdict.hpp
index 9dfa753..9f0c198 100644
--- a/dbdict.hpp
+++ b/dbdict.hpp
@@ -70,8 +70,6 @@ class LMI_SO DBDictionary
     void Add(database_entity const&);
     void InitDB();
 
-    static void InvalidateCache();
-
     // xml_serializable required implementation.
     virtual int                class_version() const;
     virtual std::string const& xml_root_name() const;
@@ -91,8 +89,6 @@ class LMI_SO DBDictionary
         ,std::string const&     file_leaf_name
         ) const;
 
-    static std::string cached_filename_;
-
     database_entity MinIssAge           ;
     database_entity MaxIssAge           ;
     database_entity MaxIncrAge          ;
-- 
1.7.10.4





reply via email to

[Prev in Thread] Current Thread [Next in Thread]