<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def maxsize(self, size):
 """Resize the cache, evicting the oldest items if necessary."""

        if size < 0:
            raise ValueError('maxsize must be non-negative')
        with self._lock:
            self._enforce_size_limit(size)
            self._maxsize = size