Skip to content

Commit 5014046

Browse files
committed
improve legibility
1 parent e185771 commit 5014046

File tree

1 file changed

+23
-20
lines changed

1 file changed

+23
-20
lines changed

content/features/proxy/examples.md

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ For several more examples demonstrating various circumstances and topologies, se
99

1010
## Basic consistent hashing to pool of servers
1111

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.
1615

16+
```lua
1717
pools{
1818
main = {
1919
backends = {
@@ -67,11 +67,11 @@ routes{
6767

6868
## Prefix router
6969

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
7473

74+
```lua
7575
pools{
7676
main = {
7777
backends = {
@@ -121,9 +121,10 @@ routes{
121121

122122
## Command map
123123

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+
124127
```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{}
127128
pools{
128129
foo = {
129130
backends = {
@@ -152,15 +153,16 @@ routes{
152153

153154
## Route by listener port with tags
154155

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+
155165
```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.
164166
pools{
165167
foo = {
166168
backends = {
@@ -205,9 +207,10 @@ routes{
205207

206208
## Nested route handlers
207209

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+
208213
```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.
211214
pools{
212215
one = {
213216
backends = {

0 commit comments

Comments
 (0)