code: def cacheshow(config, session):
      from pprint import pformat
  
      tw = py.io.TerminalWriter()
      tw.line("cachedir: " + str(config.cache._cachedir))
      if not config.cache._cachedir.is_dir():
          tw.line("cache is empty")
          return 0
  
      glob = config.option.cacheshow[0]
      if glob is None:
          glob = "*"
  
      dummy = object()
      basedir = config.cache._cachedir
      vdir = basedir / "v"
      tw.sep("-", "cache values for %r" % glob)
      for valpath in sorted(x for x in vdir.rglob(glob) if x.is_file()):
          key = valpath.relative_to(vdir)
          val = config.cache.get(key, dummy)
          if val is dummy:
              tw.line(
                  "%s contains unreadable content, will be ignored"
                  % key
              )
          else:
              tw.line("%s contains:" % key)
              for line in pformat(val).splitlines():
                  tw.line("  " + line)
  
      ddir = basedir / "d"
      if ddir.is_dir():
          contents = sorted(ddir.rglob(glob))
          tw.sep("-", "cache directories for %r" % glob)
          for p in contents:
              # if p.check(dir=1):
              #    print("%s/" % p.relto(basedir))
              if p.is_file():
                  key = p.relative_to(basedir)
                  tw.line(
                      "{} is a file of length {:d}".format(
                          key, p.stat().st_size
                      )
                  )
      return 0
  
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 6 for calling a global function with example usage: cacheshow(config, session) and returns: int, int