Changeset - 8849c07d8c62
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 13 years ago 2013-04-05 13:49:03
marcin@python-works.com
fixed prefix extractions from cache keys + cleanup
1 file changed with 18 insertions and 3 deletions:
0 comments (0 inline, 0 general)
rhodecode/model/db.py
Show inline comments
 
@@ -1650,18 +1650,33 @@ class CacheInvalidation(Base, BaseModel)
 
        self.cache_active = False
 

	
 
    def __unicode__(self):
 
        return u"<%s('%s:%s[%s]')>" % (self.__class__.__name__,
 
                            self.cache_id, self.cache_key, self.cache_active)
 

	
 
    def _cache_key_partition(self):
 
        prefix, repo_name, suffix = self.cache_key.partition(self.cache_args)
 
        return prefix, repo_name, suffix
 

	
 
    def get_prefix(self):
 
        """
 
        Guess prefix that might have been used in _get_cache_key to generate self.cache_key .
 
        Only used for informational purposes in repo_edit.html .
 
        get prefix that might have been used in _get_cache_key to
 
        generate self.cache_key. Only used for informational purposes
 
        in repo_edit.html.
 
        """
 
        return self.cache_key.split(self.cache_args, 1)[0]
 
        # prefix, repo_name, suffix
 
        return self._cache_key_partition()[0]
 

	
 
    def get_suffix(self):
 
        """
 
        get suffix that might have been used in _get_cache_key to
 
        generate self.cache_key. Only used for informational purposes
 
        in repo_edit.html.
 
        """
 
        # prefix, repo_name, suffix
 
        return self._cache_key_partition()[2]
 

	
 
    @classmethod
 
    def _get_cache_key(cls, key):
 
        """
 
        Wrapper for generating a unique cache key for this instance and "key".
 
        key must / will start with a repo_name which will be stored in .cache_args .
0 comments (0 inline, 0 general)