Created
July 28, 2012 07:40
-
-
Save faloi/3192277 to your computer and use it in GitHub Desktop.
pool de memcached
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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