title: Python cachetools stats and use custom key
body: <p>I am looking for a way to use python's <code>cachetools</code> built-in library functionality of a cache, but also support hit/miss statistics, use a custom key function, and if possible support an unbounded cache?</p>
  <p>Unfortunately, I could only find these ways:</p>
  <ol>
  <li>If I want to use an unbound cache, and have hit/miss statistics:
  <pre class="lang-py prettyprint-override"><code>from cachetools.func import lru_cache
  
  @lru_cache(maxsize=None)
  def foo(a, b, c=None):
      print(&quot;foo&quot;)
  </code></pre>
  </li>
  <li>If I want to use an unbound cache, and use a custom key function:
  <pre class="lang-py prettyprint-override"><code>from cachetools import cached
  
  @cached(
      cache={},
      key=lambda a, b, c=None: &quot;a&quot; if c is None else &quot;b&quot;
  )
  def foo(a, b, c=None):
      print(&quot;foo&quot;)
  </code></pre>
  or, use this &quot;hack&quot;:
  <pre class="lang-py prettyprint-override"><code>from cachetools import cached, LRUCache
  
  @cached(
      cache=LRUCache(maxsize=1, getsizeof=lambda _: 0), # will always pass the test of maxsize check
      key=lambda a, b, c=None: &quot;a&quot; if c is None else &quot;b&quot;
  )
  def foo(a, b, c=None):
      print(&quot;foo&quot;)
  </code></pre>
  </li>
  </ol>
  <p>How would I go about if I want to use hit/miss statistics and a custom key function?<br />
  I know how to implement one on my own, I was just wondering if there is some already built-in way in python's cachetools/functools that supports this?</p>