Exemplo n.º 1
0
    def query_key(self):
        """
        Generate the cache key for this query.

        Database router info is included to avoid the scenario where related
        cached objects from one DB (e.g. slave) are saved in another DB (e.g.
        master), throwing a Django ValueError in the process. Django prevents
        cross DB model saving among related objects.
        """
        query_db_string = 'qs:%s::db:%s' % (self.queryset.query_key(), self.db)
        return make_key(query_db_string, with_locale=False)
Exemplo n.º 2
0
def _function_cache_key(key):
    return make_key('f:%s' % key, with_locale=True)