'Change an environ value and clear all caches that depend on it.'

def __setitem__(self, key, value):

    if self.environ.get('bottle.request.readonly'):
        raise KeyError('The    environ    dictionary    is    read-only.')
    self.environ[key] = value
    todelete = ()
    if (key == 'wsgi.input'):
        todelete = ('body', 'forms', 'files', 'params', 'post', 'json')
    elif (key == 'QUERY_STRING'):
        todelete = ('query', 'params')
    elif key.startswith('HTTP_'):
        todelete = ('headers', 'cookies')
    for key in todelete:
        self.environ.pop(('bottle.request.' + key), None)
