Commit 4bf0b9df authored by Dridi Boukelmoune's avatar Dridi Boukelmoune Committed by Nils Goroll

directors: Optional weight in hash::add_backend()

It makes it easier to substitute the hash director with say, the round
robin director, when weight is not a concern.
parent 13b458a8
...@@ -26,7 +26,7 @@ varnish v1 -vcl+backend { ...@@ -26,7 +26,7 @@ varnish v1 -vcl+backend {
sub vcl_init { sub vcl_init {
new h1 = directors.hash(); new h1 = directors.hash();
h1.add_backend(s1, 1); h1.add_backend(s1);
h1.add_backend(s2, 1); h1.add_backend(s2, 1);
} }
......
...@@ -201,23 +201,24 @@ Example:: ...@@ -201,23 +201,24 @@ Example::
new vdir = directors.hash(); new vdir = directors.hash();
$Method VOID .add_backend(BACKEND, REAL) $Method VOID .add_backend(BACKEND, REAL weight = 1.0)
Add a backend to the director with a certain weight. Add a backend to the director with a certain weight.
Weight is used as in the random director. Recommended value is 1.0 Weight is used as in the random director. Recommended and default value
unless you have special needs. is 1.0 unless you have special needs.
Example:: Example::
vdir.add_backend(backend1, 1.0); vdir.add_backend(normal_backend);
vdir.add_backend(larger_backend, 1.5);
$Method VOID .remove_backend(BACKEND) $Method VOID .remove_backend(BACKEND)
Remove a backend from the director. Remove a backend from the director.
Example:: Example::
vdir.remove_backend(backend1); vdir.remove_backend(larger_backend);
$Method BACKEND .backend(STRANDS) $Method BACKEND .backend(STRANDS)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment