我们从Python开源项目中,提取了以下7个代码示例,用于说明如何使用django.apps.apps.cache_clear()。
def _expire_cache(self, forward=True, reverse=True): # This method is usually called by apps.cache_clear(), when the # registry is finalized, or when a new field is added. properties_to_expire = [] if forward: properties_to_expire.extend(self.FORWARD_PROPERTIES) if reverse and not self.abstract: properties_to_expire.extend(self.REVERSE_PROPERTIES) for cache_key in properties_to_expire: try: delattr(self, cache_key) except AttributeError: pass self._get_fields_cache = {}
def _expire_cache(self, forward=True, reverse=True): # This method is usually called by apps.cache_clear(), when the # registry is finalized, or when a new field is added. if forward: for cache_key in self.FORWARD_PROPERTIES: if cache_key in self.__dict__: delattr(self, cache_key) if reverse and not self.abstract: for cache_key in self.REVERSE_PROPERTIES: if cache_key in self.__dict__: delattr(self, cache_key) self._get_fields_cache = {}