Skip to content

Commit 52ecb06

Browse files
committed
document the cluster backend
1 parent 7127aa0 commit 52ecb06

File tree

3 files changed

+55
-1
lines changed

3 files changed

+55
-1
lines changed

docs/.nav.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ nav:
66

77
- configure
88
- async
9+
- cluster
910
- commands
1011

1112
- migration_from_django_redis.md
1213
- customize.md
13-
- changes.md
14+
- changes.md

docs/cluster/.nav.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
nav:
2+
- basic_configurations.md

docs/cluster/basic_configurations.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Basic cluster configuration
2+
3+
for installation, look at our [Installation guide](../installation.md)
4+
5+
6+
## Configure as cache backend
7+
8+
to start using django-valkey's cluster backend, change your django cache setting to something like this:
9+
10+
```python
11+
CACHES = {
12+
"default": {
13+
"BACKEND": "django_valkey.cluster_cache.cache.ClusterValkeyCache",
14+
"LOCATION": "valkey://127.0.0.1:6379",
15+
"OPTIONS": {...}
16+
}
17+
}
18+
```
19+
20+
you need to point to at least one of the cluster nodes in `LOCATION`, or pass a list of multiple nodes
21+
22+
at the moment, only one client is avilable for cluster backend
23+
24+
most of the configurations you see in [basic configuration](../configure/basic_configurations.md) and [advanced configuration](../configure/advanced_configurations.md)
25+
apply here as well, except the following:
26+
27+
28+
29+
### Memcached exception behavior
30+
in [Memcahed exception behavior](../configure/basic_configurations.md#memcached-exception-behavior) we discussed how to ignore and log exceptitions,
31+
sadly, until we find a way around it, this is not accessable with cluster backend
32+
33+
34+
## Multi-key Commands
35+
36+
please refer to [valkey-py docs](https://valkey-py.readthedocs.io/en/latest/clustering.html#multi-key-commands) on how to use multi-key commands, such as `mset`, `megt`, etc...
37+
38+
there are some other info in their documentations that might be of interest to you, we suggest you take a look
39+
40+
41+
## Additional methods
42+
in addition to what other `django-valkey` clients provide, cluster client supports the following methods:
43+
44+
* mset_nonatomic (same as `set_many`)
45+
* msetnx
46+
* mget_nonatomic (same as `get_many`)
47+
* readonly
48+
* readwrite
49+
* keyslot
50+
* flushall
51+
* invalidate_key_from_cache

0 commit comments

Comments
 (0)