Blake, you said you had plans to support sharding, right?
With an option to let users drop in their own sharding
algorithm, in case they need to interoperate with another
memcached client with its own sharding scheme.
IIRC, it was
type Chooser interface {
Choose(key string, servers []string) (n int)
}
with a DefaultChooser that does something reasonable,
so that something like
mc.New(nil, "10.0.0.1:11211", "10.0.0.2:11211")
would be the common usage. Is that about right?
kr
Though now that I think about it, the Chooser might want
to compute a relatively expensive data structure from the
list of servers (which changes infrequently), so it's
probably better to split that up into separate methods:
type Chooser interface {
Add(server string)
Remove(server string)
Choose(key string) int
}
kr
FWIW, the above interface still feels nicer. The type implementing
that interface can always do custom actions internally when it finds
unknown servers.
--
Gustavo Niemeyer
http://niemeyer.net
http://niemeyer.net/plus
http://niemeyer.net/twitter
http://niemeyer.net/blog
-- I never filed a patent.
May be the good solution to create abstract package like sql (nosql
for example) and create drivers to all nosql databases (mongo, redis,
memcache...) ?
--
Vasiliy Tolstov,
Clodo.ru
e-mail: v.to...@selfip.ru
jabber: va...@selfip.ru
2011/11/7 Gustavo Niemeyer <gus...@niemeyer.net>:May be the good solution to create abstract package like sql (nosql>>> type Chooser interface {
>>> Choose(key string, servers []string) (n int)
>>> }
>>
>> Though now that I think about it, the Chooser might want
>
> FWIW, the above interface still feels nicer. The type implementing
> that interface can always do custom actions internally when it finds
> unknown servers.
>
> --
> Gustavo Niemeyer
> http://niemeyer.net
> http://niemeyer.net/plus
> http://niemeyer.net/twitter
> http://niemeyer.net/blog
>
> -- I never filed a patent.
>
for example) and create drivers to all nosql databases (mongo, redis,
memcache...) ?