code: def _purge(self):
          
          if len(self.cache) <= self.max_size:
              return
  
          cache = self.cache
          refcount = self.refcount
          queue = self.queue
          max_size = self.max_size
  
          # purge least recently used entries, using refcount to count entries
          # that appear multiple times in the queue
          while len(cache) > max_size:
              refc = 1
              while refc:
                  k = queue.popleft()
                  refc = refcount[k] = refcount[k] - 1
              del cache[k]
              del refcount[k]
docs: Trim the cache down to max_size by evicting the
          least-recently-used entries.