parameters: (self, key, value)
docstring: Sets the value for an item. Moves the item up so that it
          has the highest priority then.
docstring_summary: Sets the value for an item. Moves the item up so that it
          has the highest priority then.
docstring_tokens: Sets the value for an item . Moves the item up so that it has the highest priority then .
function: def __setitem__(self, key, value):
          """Sets the value for an item. Moves the item up so that it
          has the highest priority then.
          """
          self._wlock.acquire()
          try:
              if key in self._mapping:
                  self._remove(key)
              elif len(self._mapping) == self.capacity:
                  del self._mapping[self._popleft()]
              self._append(key)
              self._mapping[key] = value
          finally:
              self._wlock.release()
function_tokens: def __setitem__ ( self , key , value ) : self . _wlock . acquire ( ) try : if key in self . _mapping : self . _remove ( key ) elif len ( self . _mapping ) == self . capacity : del self . _mapping [ self . _popleft ( ) ] self . _append ( key ) self . _mapping [ key ] = value finally : self . _wlock . release ( )