Documented that cache keys are strings rather than bytes.

This commit is contained in:
Adam Chainz 2016-10-06 18:01:19 +01:00 committed by Tim Graham
parent 4584bc3a1e
commit 968f61b991
1 changed files with 3 additions and 0 deletions

View File

@ -803,6 +803,9 @@ The basic interface is ``set(key, value, timeout)`` and ``get(key)``::
>>> cache.get('my_key') >>> cache.get('my_key')
'hello, world!' 'hello, world!'
``key`` should be a ``str`` (or ``unicode`` on Python 2), and ``value`` can be
any picklable Python object.
The ``timeout`` argument is optional and defaults to the ``timeout`` argument The ``timeout`` argument is optional and defaults to the ``timeout`` argument
of the appropriate backend in the :setting:`CACHES` setting (explained above). of the appropriate backend in the :setting:`CACHES` setting (explained above).
It's the number of seconds the value should be stored in the cache. Passing in It's the number of seconds the value should be stored in the cache. Passing in