Pooling framework for Memcached
Since a long time I wanted a pooling framework for Memcached API, so I decided to build one. Its fairly straight forward to use and modify, you can get the source code from my Git repository.
Following are the steps to get it up and running.
- Import the project in Eclipse
- Add the following jars to the project as they are needed for the project to compile
- commons-logging.jar (http://commons.apache.org/logging/download_logging.cgi)
- commons-pool-1.5.6.jar (http://commons.apache.org/pool/download_pool.cgi)
- junit.jar (http://sourceforge.net/projects/junit/)
- memcached-2.5.jar (http://code.google.com/p/spymemcached/downloads/list)
- I have included JUnit test, just in case !
- The settings to connect to the Membase/Memcache server are in the pooling.properties file (memcached.server)
- Pool size can be set in the same file (memcached.poolObjects)
- API currently implements SET,GET and DELETE methods, feel free to extend it and let me know, I will be more than happy to update the code.
private CachingBroker cb = new CachingBroker(); cb.set("key" ,TTL, "value"); // set cb.get("key"); // get cb.delete("key"); // delete