(self)
Maintain a cache of recently used models at the class level
Maintain a cache of recently used models at the class level
Maintain a cache of recently used models at the class level
def _update_cache(self):
        """
        Maintain a cache of recently used models at the class level
        """
        
        # Check if the model cache is full
        if self.__class__.cache_limit == len(self.__class__.model_cache):
            # Remove the oldest item from the cache if exceeding cache limit
            self.__class__.model_cache.popitem(last=False)
        
        # Remove the obsolete version of the model from the cache
        if self.model.name in self.__class__.model_cache:
            del self.__class__.model_cache[self.model.name]
        
        # Add the current model to the cache
        self.__class__.model_cache[self.model.name] = self.model
        
        # Debug information is printed to the terminal and logs if the paramater debug = true
        if self.model.debug:
            self._print_log(8)
def _update_cache ( self ) : # Check if the model cache is full if self . __class__ . cache_limit == len ( self . __class__ . model_cache ) : # Remove the oldest item from the cache if exceeding cache limit self . __class__ . model_cache . popitem ( last = False ) # Remove the obsolete version of the model from the cache if self . model . name in self . __class__ . model_cache : del self . __class__ . model_cache [ self . model . name ] # Add the current model to the cache self . __class__ . model_cache [ self . model . name ] = self . model # Debug information is printed to the terminal and logs if the paramater debug = true if self . model . debug : self . _print_log ( 8 )