@@ -9,11 +9,11 @@ For several more examples demonstrating various circumstances and topologies, se
9
9
10
10
## Basic consistent hashing to pool of servers
11
11
12
- ``` lua
13
- -- Minimal configuration.
14
- -- No high level routing: just hash keys against the pool's list of backends.
15
- -- This should be equivalent to a standard memcached client.
12
+ Minimal configuration.
13
+ No high level routing: just hash keys against the pool's list of backends.
14
+ This should be equivalent to a standard memcached client.
16
15
16
+ ``` lua
17
17
pools {
18
18
main = {
19
19
backends = {
@@ -67,11 +67,11 @@ routes{
67
67
68
68
## Prefix router
69
69
70
- ``` lua
71
- -- In this example we logically split our cache where by default keys are
72
- -- spread across a pool of servers to maximize available memory. Then, a small
73
- -- set of highly accessed "hot" keys are replicated across multiple servers
70
+ In this example we logically split our cache where by default keys are
71
+ spread across a pool of servers to maximize available memory. Then, a small
72
+ set of highly accessed "hot" keys are replicated across multiple servers
74
73
74
+ ``` lua
75
75
pools {
76
76
main = {
77
77
backends = {
@@ -121,9 +121,10 @@ routes{
121
121
122
122
## Command map
123
123
124
+ If you don't want to route based on prefix, but instead just based on the
125
+ command used, replace map with cmap when building routes{}
126
+
124
127
``` lua
125
- -- if you don't want to route based on prefix, but instead just based on the
126
- -- command used, replace map with cmap when building routes{}
127
128
pools {
128
129
foo = {
129
130
backends = {
@@ -152,15 +153,16 @@ routes{
152
153
153
154
## Route by listener port with tags
154
155
156
+ It's possible to have different route trees based on the listener port.
157
+ this is useful if you want to route to different pools by port alone, or
158
+ have different prefix trees for different services.
159
+
160
+ memcached must be started with options like:
161
+ -l 127.0.0.1:12051 -l tag_b_ :127.0.0.1:12052 -l tag_cccc_ :127.0.0.1:12053
162
+ this gives a default listener on 12051, "b" tag for 12052, and "cccc" tag
163
+ for 12053.
164
+
155
165
``` lua
156
- -- it's possible to have different route trees based on the listener port.
157
- -- this is useful if you want to route to different pools by port alone, or
158
- -- have different prefix trees for different services.
159
- --
160
- -- memcached must be started like:
161
- -- -l 127.0.0.1:12051 -l tag_b_:127.0.0.1:12052 -l tag_cccc_:127.0.0.1:12053
162
- -- this gives a default listener on 12051, "b" tag for 12052, and "cccc" tag
163
- -- for 12053.
164
166
pools {
165
167
foo = {
166
168
backends = {
@@ -205,9 +207,10 @@ routes{
205
207
206
208
## Nested route handlers
207
209
210
+ A route handler can accept another route handler for any child type entry.
211
+ This lets you freely compose complex behaviors from simpler route handlers.
212
+
208
213
``` lua
209
- -- A route handler can accept another route handler for any child type entry.
210
- -- This lets you freely compose complex behaviors from simpler route handlers.
211
214
pools {
212
215
one = {
213
216
backends = {
0 commit comments