def set(self, key, value):
    ' save value for the given key.\n\n        :param key: must be a ``/`` separated value. Usually the first\n             name is the name of your plugin or your application.\n        :param value: must be of any combination of basic\n               python types, including nested types\n               like e. g. lists of dictionaries.\n        '
    path = self._getvaluepath(key)
    try:
        path.parent.mkdir(exist_ok=True, parents=True)
    except (IOError, OSError):
        self.warn('could not create cache path {path}', path=path)
        return
    try:
        f = path.open(('wb' if PY2 else 'w'))
    except (IOError, OSError):
        self.warn('cache could not write path {path}', path=path)
    else:
        with f:
            json.dump(value, f, indent=2, sort_keys=True)
            self._ensure_readme()
save value for the given key.

:param key: must be a ``/`` separated value. Usually the first
     name is the name of your plugin or your application.
:param value: must be of any combination of basic
       python types, including nested types
       like e. g. lists of dictionaries.
def set(self, key, value):
    ' save value for the given key.\n\n        :param key: must be a ``/`` separated value. Usually the first\n             name is the name of your plugin or your application.\n        :param value: must be of any combination of basic\n               python types, including nested types\n               like e. g. lists of dictionaries.\n        '
    path = self._getvaluepath(key)
    try:
        path.parent.mkdir(exist_ok=True, parents=True)
    except (IOError, OSError):
        self.warn('could not create cache path {path}', path=path)
        return
    try:
        f = path.open(('wb' if PY2 else 'w'))
    except (IOError, OSError):
        self.warn('cache could not write path {path}', path=path)
    else:
        with f:
            json.dump(value, f, indent=2, sort_keys=True)
            self._ensure_readme()