MEMCACHED_S...LIST_APPEND(3)
π MEMCACHED_S...LIST_APPEND π
okay bestie, gather round, we're doing the libmemcached-awesome manual page for memcached_server_list_append, and honestly? it's giving "quiet little utility that runs the whole friend group." let's get into it π«Ά
β¨ NAME β¨
memcached_server_list_append β libmemcached Documentation
like yes, that's the whole name section, the docs really said "short and mysterious" π
π SYNOPSIS π
#include <libmemcached/memcached.h>
Compile and link with -lmemcached
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
void memcached_server_list_free(memcached_server_list_st list)
Parameters
list -- instance of 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)
Parameters
β’ list -- instance of an existing memcached_server_list_st
or nullptr to create one
β’ hostname -- the hostname or path to the socket, defaults
to localhost if null
β’ port -- the port to use, defaults to 11211 if 0
β’ error -- pointer to store any memcached_return_t error
indicating success
Returns
new instance of memcached_server_list_st on success or
nullptr on failure
uint32_t memcached_server_list_count(memcached_server_list_st list)
Parameters
list -- instance of memcached_server_list_st
Returns
count of servers in the list
const char *memcached_server_error(const memcached_instance_st
*instance)
Parameters
instance -- pointer to an initialized
memcached_instance_st object
Returns
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.
void memcached_servers_parse()
Deprecated since version 0.39.
See memcached().
so that's the lineup π a whole little cast of structs and functions, and we love them all. let me break down what each one is doing, because the way this page just lists them with no commentary is lowkey criminal:
memcached_server_list_free(memcached_server_list_st list)β takes anlistthat's an instance of initialized memcached_server_list_st object and frees it. bye bye, memory π¦memcached_server_list_append(memcached_server_list_st list, const char *hostname, in_port_t port, memcached_return_t *error)β the main character of this whole page, ngl. returns a new instance of memcached_server_list_st on success or nullptr on failure. the params:listβ instance of an existing memcached_server_list_st or nullptr to create one (sonullptr= fresh start, iconic)hostnameβ the hostname or path to the socket, defaults to localhost if nullportβ the port to use, defaults to 11211 if 0errorβ pointer to store any memcached_return_t error indicating success
memcached_server_list_count(memcached_server_list_st list)β returns count of servers in the list. math but make it cute π’memcached_server_error(const memcached_instance_st *instance)β returns the last error message sent from the server to the client. give it aninstancethat's a pointer to an initialized memcached_instance_st object. it's the receipts function fr fr πmemcached_server_error_reset(const memcached_instance_st *list)β Deprecated since version 0.39. that's it. that's the note. she's retired πmemcached_servers_parse()β Deprecated since version 0.39. Seememcached().
bestie warning: those last two are deprecated since version 0.39 β like, don't build your whole personality on them, okay? π
πΈ DESCRIPTION πΈ
so here's the vibe. libmemcached operates on a list of hosts which are stored in memcached_server_st structures. and the important part, listen up: You should not modify these structures directly. hands off the struct, bestie π
ββοΈ functions are provided to modify these structures β that's the whole point, use the functions.
memcached_server_list() is used to provide an array of all defined hosts. and here's a fun little lore drop: this was incorrectly documented as "requiring free" up till version 0.39. so all that time people were out here freeing things that didn't need freeing. a mess. we don't do that anymore β¨
memcached_server_list_free() deallocates all memory associated with the array of memcached_server_st that you passed to it. so when you DO pass it, it actually handles the cleanup. slay.
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. and if the value of port is zero, it is set to the default port of a memcached server. convenient? yes. π
DEPRECATED memcached_servers_parse(), please see memcached() β like I said, she's retired, redirect your energy π
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", and I'm keeping it, it's part of the heritage now π)
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. basically a glow-up for the type system, we love a rebrand π
π RETURN VALUE π
Varies, see particular functions.
that's the whole section. honestly? iconic minimalism. every function has its own little return story, go read the one you need, bestie π¦
π SEE ALSO π
memcached(1) libmemcached(3) memcached_servers(3) memcached_strerror(3)
the whole friend group π go say hi.
and that's the page!! this is libmemcached-awesome, version 1.1, dated Jul 24, 2025 β so yeah, fresh, current, no cap. go build something cute with your server lists, and remember: don't touch the structs directly, use the functions, free responsibly, and never trust documentation from before 0.39 π«Άβ¨π
π¦ where this page comes from
- fedora 43: libmemcached-awesome-devel 1.1.4-7.fc43 Β· BSD-3-Clause
- fedora 43: libmemcached-awesome-devel 1.1.4-7.fc43 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms