Permalink
Browse files

use ketama_weighted algorithm in memcached_drv. now compatible with e…

…rlang implementation.
  • Loading branch information...
1 parent 12fc8ad commit 637bfd1dbc5ce2f09e9566694ba5f29a7fa89bbd @echou committed Dec 17, 2009
Showing with 2 additions and 2 deletions.
  1. +1 −1 lib/mcache/c_src/memcached_drv.cpp
  2. +1 −1 lib/mcache/src/mcache_memcached_drv_sup.erl
@@ -33,7 +33,7 @@ class Cache
void initBehaviors()
{
- memcached_behavior_set(mc, MEMCACHED_BEHAVIOR_KETAMA, 1);
+ memcached_behavior_set(mc, MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED, 1);
memcached_behavior_set(mc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 1);
memcached_behavior_set(mc, MEMCACHED_BEHAVIOR_NO_BLOCK, 1);
memcached_behavior_set(mc, MEMCACHED_BEHAVIOR_TCP_NODELAY, 1);
@@ -18,7 +18,7 @@ init([]) ->
Specs = lists:map(fun(Pool) ->
Name = proplists:get_value(name, Pool),
Servers = proplists:get_value(servers, Pool),
- S1 = string:join([Addr||{Addr, _}<-Servers], ","),
+ S1 = string:join([Addr ++ ":" ++ integer_to_list(Weight)||{Addr, Weight}<-Servers], ","),
{ {memcached_drv, Name},
{memcached_drv, start_link, [Name, S1]},
permanent, 2000, worker, []

0 comments on commit 637bfd1

Please sign in to comment.