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
Resize the cache, evicting the oldest items if necessary.