class_docstr: Instance of the `cache` fixture.
class_docstr_tok: ["Instance","of","the","`","cache","`","fixture","."]
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 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","lists","of","dictionaries","."]
code: def set(self, key: str, value: object) -> None:
      """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 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 OSError as exc:
          self.warn(
              f"could not create cache path {path}: {exc}",
              _ispytest=True,
          )
          return
      if not cache_dir_exists_already:
          self._ensure_supporting_files()
      data = json.dumps(value, ensure_ascii=False, indent=2)
      try:
          f = path.open("w", encoding="UTF-8")
      except OSError as exc:
          self.warn(
              f"cache could not write path {path}: {exc}",
              _ispytest=True,
          )
      else:
          with f:
              f.write(data)
  
imports: import dataclasses
  import json
  import os
  from pathlib import Path
  from typing import Dict
  from typing import final
  from typing import Generator
  from typing import Iterable
  from typing import List
  from typing import Optional
  from typing import Set
  from typing import Union
  from .pathlib import resolve_from_str
  from .pathlib import rm_rf
  from .reports import CollectReport
  from _pytest import nodes
  from _pytest._io import TerminalWriter
  from _pytest.config import Config
  from _pytest.config import ExitCode
  from _pytest.config import hookimpl
  from _pytest.config.argparsing import Parser
  from _pytest.deprecated import check_ispytest
  from _pytest.fixtures import fixture
  from _pytest.fixtures import FixtureRequest
  from _pytest.main import Session
  from _pytest.nodes import Directory
  from _pytest.nodes import File
  from _pytest.reports import TestReport
label_desc: Use image node_id 9 for calling the Cache obj's underlying member method code with example usage: obj.set(key, value) without return types