docstr: 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.
docstr_tok: ["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","."]
code: def set(self, key, value):
      """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.
      """
      path = self._getvaluepath(key)
      try:
          if path.parent.is_dir():
              cache_dir_exists_already = True
          else:
              cache_dir_exists_already = self._cachedir.exists()
              path.parent.mkdir(exist_ok=True, parents=True)
      except (IOError, OSError):
          self.warn("could not create cache path {path}", path=path)
          return
      if not cache_dir_exists_already:
          self._ensure_supporting_files()
      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)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import json
  import os
  from collections import OrderedDict
  import attr
  import py
  import six
  import pytest
  from .compat import _PY2
  from .pathlib import Path
  from .pathlib import resolve_from_str
  from .pathlib import rm_rf
label_desc: Use image node_id 7 for calling the Cache obj's underlying member method code with example usage: obj.set(key, value) without return types