You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(providers): Sanitize nuts properties from configuration (#221)
* fix(providers): Sanitize nuts properties from configuration
* Support cache_keys JSON configuration
* keep stale on purge if strategy is not hard
* Fix stale surrogate invalidation
* Update E2E tests
* Group configuration object
* Surrogate_keys enhancement
* Fix surrogate with commas
* Support the etcd provider
* Fix nutsdb regex based cache purge. (#222)
* Handle delete many by regexp on etcd provider
* Increase wait for Chi & Webgo run to 30s
* Remove Yoda conditions
* Remove useless print
Co-authored-by: Kiss Károly Pál <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+31-5
Original file line number
Diff line number
Diff line change
@@ -90,14 +90,20 @@ default_cache:
90
90
- GET
91
91
- POST
92
92
- HEAD
93
-
distributed: true # Use Olric distributed storage
93
+
distributed: true # Use Olric or Etcd distributed storage
94
94
headers: # Default headers concatenated in stored keys
95
95
- Authorization
96
96
key:
97
97
disable_body: true
98
98
disable_host: true
99
99
disable_method: true
100
-
olric: # If distributed is set to true, you'll have to define the olric section
100
+
etcd: # If distributed is set to true, you'll have to define either the etcd or olric section
101
+
configuration: # Configure directly the Etcd client
102
+
endpoints: # Define multiple endpoints
103
+
- etcd-1:2379 # First node
104
+
- etcd-2:2379 # Second node
105
+
- etcd-3:2379 # Third node
106
+
olric: # If distributed is set to true, you'll have to define either the etcd or olric section
101
107
url: 'olric:3320' # Olric server
102
108
regex:
103
109
exclude: 'ARegexHere' # Regex to exclude from cache
@@ -171,6 +177,8 @@ surrogate_keys:
171
177
| `default_cache.key.disable_body` | Disable the body part in the key (GraphQL context) | `true`<br/><br/>`(default: false)` |
172
178
| `default_cache.key.disable_host` | Disable the host part in the key | `true`<br/><br/>`(default: false)` |
173
179
| `default_cache.key.disable_method` | Disable the method part in the key | `true`<br/><br/>`(default: false)` |
180
+
| `default_cache.etcd` | Configure the Etcd cache storage | |
181
+
| `default_cache.etcd.configuration` | Configure Etcd directly in the Caddyfile or your JSON caddy configuration | [See the Etcd configuration for the options](https://pkg.go.dev/go.etcd.io/etcd/clientv3#Config) |
174
182
| `default_cache.olric` | Configure the Olric cache storage | |
175
183
| `default_cache.olric.path` | Configure Olric with a file | `/anywhere/olric_configuration.json` |
176
184
| `default_cache.olric.configuration` | Configure Olric directly in the Caddyfile or your JSON caddy configuration | [See the Olric configuration for the options](https://github.com/buraksezer/olric/blob/master/cmd/olricd/olricd.yaml/) |
@@ -243,9 +251,10 @@ See the sequence diagram for the minimal version below
The cache system sits on top of three providers at the moment. It provides two in-memory storage solutions (badger and nuts), and a distributed storage called Olric because setting, getting, updating and deleting keys in these providers is as easy as it gets.
257
+
The cache system sits on top of three providers at the moment. It provides two in-memory storage solutions (badger and nuts), and two distributed storages Olric and Etcd because setting, getting, updating and deleting keys in these providers is as easy as it gets.
249
258
**The Badger provider (default one)**: you can tune its configuration using the badger configuration inside your Souin configuration. In order to do that, you have to declare the `badger` block. See the following json example.
250
259
```json
251
260
"badger": {
@@ -284,8 +293,19 @@ The cache system sits on top of three providers at the moment. It provides two i
284
293
}
285
294
```
286
295
In order to do that, the Olric provider need to be either on the same network as the Souin instance when using docker-compose or over the internet, then it will use by default in-memory to avoid network latency as much as possible.
296
+
297
+
**The Etcd provider**: you can tune its configuration using the etcd configuration inside your Souin configuration and declare Souin has to use the distributed provider. In order to do that, you have to declare the `etcd` block and the `distributed` directive. See the following json example.
298
+
```json
299
+
"distributed": true,
300
+
"etcd": {
301
+
"configuration": {
302
+
# Etcd configuration here...
303
+
}
304
+
}
305
+
```
306
+
In order to do that, the Etcd provider need to be either on the same network as the Souin instance when using docker-compose or over the internet, then it will use by default in-memory to avoid network latency as much as possible.
287
307
Souin will return at first the response from the choosen provider when it gives a non-empty response, or fallback to the reverse proxy otherwise.
288
-
Since v1.4.2, Souin supports [Olric](https://github.com/buraksezer/olric) to handle distributed cache.
308
+
Since v1.4.2, Souin supports [Olric](https://github.com/buraksezer/olric) and since v1.6.10 it supports [Etcd](https://github.com/etcd-io/etcd) to handle distributed cache.
289
309
290
310
## GraphQL
291
311
This feature is currently in beta.
@@ -435,11 +455,16 @@ There is the fully configuration below
435
455
disable_method
436
456
}
437
457
log_level debug
458
+
etcd {
459
+
configuration {
460
+
# Your Etcd configuration here
461
+
}
462
+
}
438
463
olric {
439
464
url url_to_your_cluster:3320
440
465
path the_path_to_a_file.yaml
441
466
configuration {
442
-
# Your badger configuration here
467
+
# Your Olric configuration here
443
468
}
444
469
}
445
470
regex {
@@ -918,3 +943,4 @@ Thanks to these users for contributing or helping this project in any way
0 commit comments