diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-10-25 12:27:27 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-10-25 12:27:56 +0200 |
| commit | 415ef34c4c2d4e9416ecf04ddf8cfb33585f1934 (patch) | |
| tree | 12194fbcd557df1cd3ea5099307da032ad360812 /docs/topics/cache.txt | |
| parent | 8b18e0bb3ba8bb1f51e15487a6d5402853e637ae (diff) | |
[5.0.x] Added missing pycon directives in various docs.
Backport of 718b32c6918037cfc746d7867333d79a3c887a8c from main
Diffstat (limited to 'docs/topics/cache.txt')
| -rw-r--r-- | docs/topics/cache.txt | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/docs/topics/cache.txt b/docs/topics/cache.txt index abdbea0e0a..5935c3e27f 100644 --- a/docs/topics/cache.txt +++ b/docs/topics/cache.txt @@ -872,9 +872,11 @@ Accessing the cache requests for the same alias in the same thread will return the same object. + .. code-block:: pycon + >>> from django.core.cache import caches - >>> cache1 = caches['myalias'] - >>> cache2 = caches['myalias'] + >>> cache1 = caches["myalias"] + >>> cache2 = caches["myalias"] >>> cache1 is cache2 True @@ -906,11 +908,15 @@ The basic interface is: .. method:: cache.set(key, value, timeout=DEFAULT_TIMEOUT, version=None) - >>> cache.set('my_key', 'hello, world!', 30) +.. code-block:: pycon + + >>> cache.set("my_key", "hello, world!", 30) .. method:: cache.get(key, default=None, version=None) - >>> cache.get('my_key') +.. code-block:: pycon + + >>> cache.get("my_key") 'hello, world!' ``key`` should be a ``str``, and ``value`` can be any picklable Python object. @@ -1100,6 +1106,8 @@ nonexistent cache key: You can close the connection to your cache with ``close()`` if implemented by the cache backend. +.. code-block:: pycon + >>> cache.close() .. note:: |
