[entropy.client] drop _get_available_packages_hash()

This commit is contained in:
Fabio Erculiani
2013-12-29 11:08:46 +01:00
parent d0cf15ffc6
commit b4196026d8
2 changed files with 22 additions and 19 deletions
+1 -14
View File
@@ -25,17 +25,4 @@ from entropy.db.exceptions import OperationalError, DatabaseError, \
class CacheMixin:
def _get_available_packages_hash(self):
"""
Get available packages cache hash.
"""
# client digest not needed, cache is kept updated
c_hash = "%s|%s|%s|v1" % (
self.repositories_checksum(),
self.filter_repositories(self.repositories()),
# needed when users do bogus things like editing config files
# manually (branch setting)
self._settings['repositories']['branch'])
sha = hashlib.sha1()
sha.update(const_convert_to_rawstring(repr(c_hash)))
return sha.hexdigest()
pass
+21 -5
View File
@@ -2871,9 +2871,16 @@ class CalculatorsMixin:
[((package_id, repository_id), reason_id), ...]
@rtype: list
"""
cache_key = "available/masked_%s_v2" % (
self._get_available_packages_hash(),
)
sha = hashlib.sha1()
cache_s = "{%s;%s}v2" % (
self.repositories_checksum(),
# needed when users do bogus things like editing config files
# manually (branch setting)
self._settings['repositories']['branch'])
sha.update(const_convert_to_rawstring(cache_s))
cache_key = "available/masked_%s" % (sha.hexdigest(),)
if use_cache and self.xcache:
cached = self._cacher.pop(cache_key)
@@ -2921,8 +2928,17 @@ class CalculatorsMixin:
@return: list of available package matches
@rtype: list
"""
cache_key = "available_packages/%s" % (
self._get_available_packages_hash(),)
sha = hashlib.sha1()
cache_s = "{%s;%s}v2" % (
self.repositories_checksum(),
# needed when users do bogus things like editing config files
# manually (branch setting)
self._settings['repositories']['branch'])
sha.update(const_convert_to_rawstring(cache_s))
cache_key = "available/packages_%s" % (sha.hexdigest(),)
if use_cache and self.xcache:
cached = self._cacher.pop(cache_key)
if cached is not None: