docstr: Cache a list of values. The fixed keys won't be removed. For other keys, LRU is applied.
  When the value list is not full, a cache miss occurs. Otherwise, a cache hit occurs. Redundant values will be removed.
  
  Args:
      cache_size (int): Max size for LRU cache.
      list_size (int): Value list size.
      fixed_keys (List[Hashable], optional): The keys which won't be removed. Defaults to [].
docstr_tok: ["Cache","a","list","of","values",".","The","fixed","keys","wo","n't","be","removed",".","For","other","keys",",","LRU","is","applied",".","When","the","value","list","is","not","full",",","a","cache","miss","occurs",".","Otherwise",",","a","cache","hit","occurs",".","Redundant","values","will","be","removed",".","Args",":","cache_size","(","int",")",":","Max","size","for","LRU","cache",".","list_size","(","int",")",":","Value","list","size",".","fixed_keys","(","List","[","Hashable","]",",","optional",")",":","The","keys","which","wo","n't","be","removed",".","Defaults","to","[","]","."]
code: def __init__(
      self,
      cache_size: int,
      list_size: int,
      fixed_keys: List[Hashable] = [],
  ) -> None:
      """Cache a list of values. The fixed keys won't be removed. For other keys, LRU is applied.
      When the value list is not full, a cache miss occurs. Otherwise, a cache hit occurs. Redundant values will be removed.
  
      Args:
          cache_size (int): Max size for LRU cache.
          list_size (int): Value list size.
          fixed_keys (List[Hashable], optional): The keys which won't be removed. Defaults to [].
      """
      self.cache_size = cache_size
      self.list_size = list_size
      self.cache: OrderedDict[Hashable, List[Any]] = OrderedDict()
      self.fixed_cache: Dict[Hashable, List[Any]] = {}
      for key in fixed_keys:
          self.fixed_cache[key] = []
      self._lock = Lock()
  
file_path: colossalai/examples/tutorial/opt/inference/cache.py
imports: from collections import OrderedDict
  from contextlib import contextmanager
  from threading import Lock
  from typing import Any, Dict, Hashable, List
label_desc: Use image node_id 1 to create a new ListCache object  with example: obj = ListCache(cache_size, list_size, fixed_keys)