From c9673d92046517816eef5f92daf870313652d616 Mon Sep 17 00:00:00 2001 From: Guido Trotter <ultrotter@google.com> Date: Wed, 11 Jun 2008 10:12:25 +0000 Subject: [PATCH] Remove SimpleStore cache SimpleStore is instantiated anew most of the times it's used, so having a cache inside it serves no purpose. Removing it. Reviewed-by: iustinp --- lib/ssconf.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lib/ssconf.py b/lib/ssconf.py index 120d85d6c..389071314 100644 --- a/lib/ssconf.py +++ b/lib/ssconf.py @@ -47,7 +47,6 @@ class SimpleStore: Other particularities of the datastore: - keys are restricted to predefined values - values are small (<4k) - - since the data is practically static, read keys are cached in memory - some keys are handled specially (read from the system, so we can't update them) @@ -71,7 +70,6 @@ class SimpleStore: self._cfg_dir = constants.DATA_DIR else: self._cfg_dir = cfg_location - self._cache = {} def KeyToFilename(self, key): """Convert a given key into filename. @@ -91,8 +89,6 @@ class SimpleStore: will be changed into ConfigurationErrors. """ - if key in self._cache: - return self._cache[key] filename = self.KeyToFilename(key) try: fh = file(filename, 'r') @@ -104,7 +100,6 @@ class SimpleStore: except EnvironmentError, err: raise errors.ConfigurationError("Can't read from the ssconf file:" " '%s'" % str(err)) - self._cache[key] = data return data def GetNodeDaemonPort(self): @@ -185,7 +180,6 @@ class SimpleStore: file_name = self.KeyToFilename(key) utils.WriteFile(file_name, data="%s\n" % str(value), uid=0, gid=0, mode=0400) - self._cache[key] = value def GetFileList(self): """Return the list of all config files. -- GitLab