MEMCACHED_SERVER_LIST_COUNT(3)

πŸ’– MEMCACHED_SERVER_LIST_COUNT πŸ’–

okay bestie, welcome to libmemcached-awesome β€” this page is MEMCACHED_S...R_LIST_COUNT(3) and it's all about the lil list of servers you're talking to. let's get into it 🫢


✨ NAME ✨

memcached_server_list_count β€” libmemcached Documentation

like, that's the whole name, that's the whole vibe. πŸ“–


🌸 SYNOPSIS 🌸

#include <libmemcached/memcached.h>

and bestie you gotta Compile and link with -lmemcached or none of this works, fr fr.

typedef struct memcached_instance_st memcached_instance_st

typedef struct memcached_server_st memcached_server_st

typedef struct memcached_server_st *memcached_server_list_st

okay and then the actual functions πŸ‘‡

void memcached_server_list_free(memcached_server_list_st list)
  • list β€” an instance of an initialized memcached_server_list_st object
memcached_server_list_st
memcached_server_list_append(memcached_server_list_st list, const char
*hostname, in_port_t port, memcached_return_t *error)
  • list β€” an instance of an existing memcached_server_list_st, or nullptr if you wanna create a fresh one 🐣
  • hostname β€” the hostname or path to the socket; if it's null it defaults to localhost
  • port β€” the port to use; if it's 0 it defaults to 11211
  • error β€” pointer to store any memcached_return_t error, and it'll tell you if it succeeded

Returns β€” a new instance of memcached_server_list_st if it worked, or nullptr if it flopped 😭

uint32_t memcached_server_list_count(memcached_server_list_st list)
  • list β€” instance of memcached_server_list_st

Returns β€” the count of servers in the list. that's it. that's the whole function. iconic. πŸ‘‘

const char *memcached_server_error(const memcached_instance_st
*instance)
  • instance β€” pointer to an initialized memcached_instance_st object

Returns β€” the last error message sent from the server to the client πŸ“©

void memcached_server_error_reset(const memcached_instance_st *list)
Deprecated since version 0.39. bestie she's retired, do not use her πŸ’€
void memcached_servers_parse()
Deprecated since version 0.39. See memcached().

πŸ¦‹ DESCRIPTION πŸ¦‹

so libmemcached operates on a list of hosts which are stored in memcached_server_st structures. and listen β€” you should not modify these structures directly. nope. hands off. Functions are provided to modify these structures, so use those instead, okay? πŸ™ˆ

memcached_server_list() is used to provide an array of all defined hosts. fun lil historical note: this was incorrectly documented as "requiring free" up till version 0.39. so if you saw that somewhere, no you didn't. πŸ’…

memcached_server_list_free() deallocates all memory associated with the array of memcached_server_st that you passed to it. clean up after yourself, bestie 🧹

memcached_server_list_append() adds a server to the end of a memcached_server_st array. On error null will be returned and the memcached_return_t pointer you passed into the function will be set with the appropriate error. If the value of port is zero, it is set to the default port of a memcached server. ✨

DEPRECATED: memcached_servers_parse(), please see memcached() πŸ™

memcached_server_error() can be used to look at the text of the last error message sent by the server to to the client. (yes the original says "to to", we're keeping it, it's giving typo chic πŸŽ€)

Before version 0.39 theses functions used a memcached_server_st *. In 0.39 memcached_server_st * was aliased to memcached_server_list_st. This was done for a style reason to help clean up some concepts in the code. a lil glow-up, if you will. πŸ’–


πŸ’œ RETURN VALUE πŸ’œ

Varies, see particular functions. that's it, that's the answer, check the individual function babe 😌


🌈 SEE ALSO 🌈


and that's the whole page bestie!! πŸ’• this is version 1.1, dated Jul 24, 2025, from the libmemcached-awesome girlies. go forth and count your servers, mwah πŸ’‹βœ¨πŸ¦‹πŸŽ€

πŸ“¦ where this page comes from