Friday, April 1, 2011

libmemcached configure language

In the next version we are rolling out the new configuration language that we developed a while ago.


 
Configuration is hard, and trying to determine all of the little options can be time consuming. A while ago for a couple of customers we wrote a configuration language and a couple of other utilities to simplify the process.



In the next version of libmemcached we will be rolling out the API for it.  Here is an example:



memcached_parse_configuration(memc, "--DISTRIBUTION=consistent,MD5 --servers=localhost:11221,localhost:11222,localhost:11223,localhost:11224,localhost:11225 --CONNECT_TIMEOUT=456 --NUMBER_OF_REPLICAS=2");


It can either parse via a string you pass to it, or it can read everything from a file.


 There are a number of options to the language like “RESET” which will take a configuration and reset it at the point that the keyword is found. END which will allow you to stop parsing, INCLUDE which will let you include files that will be parsed as well.


 There are a number of other bits to the language as well.


The code is now in lp:libmemcached, I am hoping to publish a new version sometime in the next few days. 



Have fun with it!

No comments:

Post a Comment