File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed
Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,31 @@ behaves in the same way as django backend contract specifies:
3030 cache.set(" key" , " value" , timeout = None )
3131
3232
33+ Get and Set in bulk
34+ *******************
35+
36+ django-valkey has two different kind of method for bulk get/set: atomic and non-atomic.
37+
38+ atomic operations are done with ``mget() `` and ``mset() ``
39+
40+ .. code-block :: pycon
41+
42+ >>> from django.core.cache import cache
43+ >>> cache.mset({"a": 1, "b": 2})
44+ >>> cache.mget(["a", "b"])
45+ {"a": 1, "b": 2}
46+
47+ the non atomic operations are done with ``get_many() `` and ``set_many()``doen
48+
49+ .. code-block:: pycon
50+
51+ >>> from django.core.cache import cache
52+ >>> cache.set_many({"a": 1, "b": 2})
53+ >>> cache.get_many(["a", "b"])
54+ {"a": 1, "b": 2}
55+
56+ **Note**: django-redis users should note that in django redis ``get_many() `` is an atomic operation, but ``set_many() `` is non-atomic.
57+
3358Scan and Delete in bulk
3459***********************
3560
Original file line number Diff line number Diff line change @@ -34,6 +34,14 @@ you can easily fix this by running this commands:
3434 where settings.py is the file you have your configs in, change the file name if you are using a different name.
3535
3636
37+ Different commands
38+ ##################
39+
40+ in django-redis, ``get_many() `` is an atomic operation, but ``set_many() `` is non-atomic.
41+
42+ in django-valkey ``mget() `` and ``mset() `` are atomic, and ``get_many() `` and ``set_many() `` are non-atomic.
43+
44+
3745More options
3846############
3947
You can’t perform that action at this time.
0 commit comments