コード例 #1
0
ファイル: query.py プロジェクト: peterdds/django-cacheops
    def _cache_key(self, extra=''):
        """
        Compute a cache key for this queryset
        """
        md5 = hashlib.md5()
        md5.update(str(self.__class__))
        md5.update(stamp_fields(self.model)) # Protect from field list changes in model
        md5.update(stringify_query(self.query))
        if extra:
            md5.update(str(extra))
        # 'flat' attribute changes results formatting for ValuesQuerySet
        if hasattr(self, 'flat'):
            md5.update(str(self.flat))

        return 'q:%s' % md5.hexdigest()
コード例 #2
0
ファイル: query.py プロジェクト: koodjo/django-cacheops
    def _cache_key(self, extra=''):
        """
        Compute a cache key for this queryset
        """
        md5 = cross.md5()
        md5.update('%s.%s' % (self.__class__.__module__, self.__class__.__name__))
        md5.update(stamp_fields(self.model)) # Protect from field list changes in model
        md5.update(stringify_query(self.query))
        # If query results differ depending on database
        if self._cacheprofile and not self._cacheprofile['db_agnostic']:
            md5.update(self.db)
        if extra:
            md5.update(str(extra))
        # 'flat' attribute changes results formatting for ValuesQuerySet
        if hasattr(self, 'flat'):
            md5.update(str(self.flat))

        return 'q:%s' % md5.hexdigest()
コード例 #3
0
ファイル: query.py プロジェクト: hellysmile/django-cacheops
    def _cache_key(self, extra=""):
        """
        Compute a cache key for this queryset
        """
        md5 = hashlib.md5()
        md5.update(str(self.__class__))
        md5.update(stamp_fields(self.model))  # Protect from field list changes in model
        md5.update(stringify_query(self.query))
        # If query results differ depending on database
        if not self._cacheprofile["db_agnostic"]:
            md5.update(self.db)
        if extra:
            md5.update(str(extra))
        # 'flat' attribute changes results formatting for ValuesQuerySet
        if hasattr(self, "flat"):
            md5.update(str(self.flat))

        return "q:%s" % md5.hexdigest()
コード例 #4
0
ファイル: query.py プロジェクト: seban016/django-cacheops
    def _cache_key(self, extra=''):
        """
        Compute a cache key for this queryset
        """
        md5 = hashlib.md5()
        md5.update(str(self.__class__))
        md5.update(stamp_fields(
            self.model))  # Protect from field list changes in model
        md5.update(stringify_query(self.query))
        # If query results differ depending on database
        if not self._cacheprofile['db_agnostic']:
            md5.update(self.db)
        if extra:
            md5.update(str(extra))
        # 'flat' attribute changes results formatting for ValuesQuerySet
        if hasattr(self, 'flat'):
            md5.update(str(self.flat))

        return 'q:%s' % md5.hexdigest()