title: How do I work with cached values created by flask-cache
body: <p>I'm using flask-cache in an app and trying to prepopulate the cache in a separate process. The problem is I can't figure out the format the cached values are stored in.</p>
  
  <p>Looking at the cached values they look like they've been pickled, but the values created by cached functions are slightly different from normal pickled values and can't be unpickled directly. Here's an example:</p>
  
  <p>Here is my flask view:</p>
  
  <pre><code>@app.route('/index')
  @cache.cached(timeout=60)
  def index():
      return 'foo'
  </code></pre>
  
  <p>Here is the cached value from my view, stored in redis:</p>
  
  <pre><code>&gt;&gt;&gt; r = redis.StrictRedis()
  &gt;&gt;&gt; r.keys()
  [b'flask_cache_view//index']
  &gt;&gt;&gt; r.get('flask_cache_view//index')
  b'!\x80\x03X\x03\x00\x00\x00fooq\x00.'
  </code></pre>
  
  <p>Notice the cached bytestring has a leading '!'. Compare to manually pickling 'foo':</p>
  
  <pre><code>&gt;&gt;&gt; import pickle
  &gt;&gt;&gt; pickle.dumps('foo')
  b'\x80\x03X\x03\x00\x00\x00fooq\x00.'
  </code></pre>
  
  <p>The latter can be unpickled, but attempting to unpickle the flask-cache value results in an error "_pickle.UnpicklingError: invalid load key, '!'."</p>
  
  <p>Because I don't fully understand the problem I'm not comfortable implementing a solution (e.g. removing / prepending '!' on all bytestrings). Am I on the right track here?</p>