diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-06-04 20:41:35 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-06-04 20:41:35 +0000 |
commit | 5de053520ef2a24b5ce0ff092685c1346fc83ce3 (patch) | |
tree | 95339ba48ef731650fb0927abde2161277c92ede /pym | |
parent | 3dc590d344e9155298d92095bafa173e3c40c5c2 (diff) | |
download | portage-5de053520ef2a24b5ce0ff092685c1346fc83ce3.tar.gz portage-5de053520ef2a24b5ce0ff092685c1346fc83ce3.tar.bz2 portage-5de053520ef2a24b5ce0ff092685c1346fc83ce3.zip |
Use sets for more accurate cache modification counts in BlockerCache and
vardbapi. (trunk r10578)
svn path=/main/branches/2.1.2/; revision=10579
Diffstat (limited to 'pym')
-rw-r--r-- | pym/portage.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/pym/portage.py b/pym/portage.py index 8ccc64316..98b71626e 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -7027,7 +7027,7 @@ class vardbapi(dbapi): users have read access and benefit from faster metadata lookups (as long as at least part of the cache is still valid).""" if self._aux_cache is not None and \ - self._aux_cache["modified"] >= self._aux_cache_threshold and \ + len(self._aux_cache["modified"]) >= self._aux_cache_threshold and \ secpass >= 2: valid_nodes = set(self.cpv_all()) for cpv in self._aux_cache["packages"].keys(): @@ -7042,7 +7042,7 @@ class vardbapi(dbapi): self._aux_cache_filename, gid=portage_gid, mode=0644) except (IOError, OSError), e: pass - self._aux_cache["modified"] = 0 + self._aux_cache["modified"] = set() def aux_get(self, mycpv, wants): """This automatically caches selected keys that are frequently needed @@ -7084,7 +7084,7 @@ class vardbapi(dbapi): not self._aux_cache.get("packages"): self._aux_cache = {"version": self._aux_cache_version} self._aux_cache["packages"] = {} - self._aux_cache["modified"] = 0 + self._aux_cache["modified"] = set() mydir = os.path.join(self.root, VDB_PATH, mycpv) mydir_stat = None try: @@ -7129,7 +7129,7 @@ class vardbapi(dbapi): for aux_key in cache_these: cache_data[aux_key] = mydata[aux_key] self._aux_cache["packages"][mycpv] = (mydir_mtime, cache_data) - self._aux_cache["modified"] += 1 + self._aux_cache["modified"].add(mycpv) return [mydata[x] for x in wants] def _aux_get(self, mycpv, wants): |