3 ms·
The superficial answer is that Riak, unlike Redis, is a cluster, where you may wish to talk to multiple servers, and therefore having a single-string constructo
by gecko 15y ago
The superficial answer is that Riak, unlike Redis, is a cluster, where you may wish to talk to multiple servers, and therefore having a single-string constructor makes no sense. I believe they're modeling it after the way you configure the Enyim Memcached library (https://github.com/enyim/EnyimMemcached https://github.com/enyim/EnyimMemcached), which has a similar configuration section, for similar reasons (https://github.com/enyim/EnyimMemcached/wiki/MemcachedClient-Configuration https://github.com/enyim/EnyimMemcached/wiki/MemcachedClient...).
That does not answer why the code to create the client is so ridiculous. Enyim's MemcacheClient gets instantiated like this:
MemcachedClient client = new MemcachedClient(configuration);
Why this Riak library feels the need to go so above and beyond the call of duty, I have no idea.
- OJ 15y agogecko, Our design was not modeled on any existing library's approach to configuration. It was designed based on what we perceived the needs of the application to be. I think making claims that the configuration is "ridiculous" isn't constructive conversation, especially when you haven't really backed up why you consider it to be so. After three lines of wiring, a caller creates a self-managing client instance via: var client = cluster.CreateClient(); I don't see how this can be considered ridiculous. A simple comparison to one line of code (which, I might add, doesn't explain where the `configuration` variable comes from) is not really thorough. I'd be keen to see what it takes to get the configuration loaded and what extra boilerplate is required to handle and manage the MemcachedClient. Thanks for the comment.