Skip to content

Instantly share code, notes, and snippets.

@faloi
Created July 28, 2012 07:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save faloi/3192277 to your computer and use it in GitHub Desktop.
Save faloi/3192277 to your computer and use it in GitHub Desktop.
pool de memcached
memcached_return cache_create(const char* ip, int port, int max_instances) {
memcached_server_st *server = NULL;
memcached_return ret_cache;
connections = sync_queue_create();
server = memcached_server_list_append(server, ip, port, &ret_cache);
int i;
for (i = 0; i < max_instances; i++) {
memcached_st* cache = memcached_create(NULL);
ret_cache = memcached_server_push(cache, server);
sync_queue_push(connections, cache);
}
return ret_cache;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment