def __init__(self, max_size=0):
""" Builds a cache with a limit of max_size entries.
If this limit is exceeded, the Least Recently Used entry is discarded.
if max_size==0, the cache is unbounded (no LRU rule is applied).
"""
object.__init__(self)
self._maxsize=max_size
self._dict={}
self._lock=Lock()
# Header of the access list
if self._maxsize:
self._head=Entry(None)
self._head._previous=self._head
self._head._next=self._head
评论列表
文章目录