MEMCACHED_SERVER_LIST_FREE(3)

πŸ’– MEMCACHED_SERVER_LIST_FREE πŸ’–

okay so hi bestie, welcome to section 3 of the manual for libmemcached-awesome 🌸 this is the page about memcached_server_list_free and the lil server-list squad it rolls with. grab a boba, we're doing pointers πŸ§‹βœ¨


✨ NAME ✨

memcached_server_list_free β€” libmemcached Documentation. that's it, that's the name, no cap πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

first things first, you gotta pull in the header:

#include <libmemcached/memcached.h>

and then you compile and link with -lmemcached. yes literally those exact flags, don't freestyle it πŸ™ˆ

now the typedefs, and listen, these are important so read them slowly:

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 here come the functions πŸ‘‘

🌟 memcached_server_list_free

void memcached_server_list_free(memcached_server_list_st list)

Parameters

  • list β€” instance of initialized memcached_server_list_st object

🌟 memcached_server_list_append

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

🌟 memcached_server_list_count

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

🌟 memcached_server_error

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

🌟 memcached_server_error_reset

void memcached_server_error_reset(const memcached_instance_st *list)
🚫 Deprecated since version 0.39. she's retired bestie, do not use her.

🌟 memcached_servers_parse

void memcached_servers_parse()
🚫 Deprecated since version 0.39.

See memcached().


πŸ’œ DESCRIPTION πŸ’œ

so here's the whole vibe: libmemcached operates on a list of hosts which are stored in memcached_server_st structures. and like, do NOT modify these structures directly, i'm so serious 😭 that's literally what the functions are for. Functions are provided to modify these structures. use them. love them. respect them. 🫢

memcached_server_list() is used to provide an array of all defined hosts. and okay funny story, this was incorrectly documented as "requiring free" up till version 0.39. embarrassing behavior honestly, we don't talk about it πŸ’€

memcached_server_list_free() deallocates all memory associated with the array of memcached_server_st that you passed to it. it's giving cleanup era 🧹✨

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. cute right? iconic default behavior πŸ’…

DEPRECATED memcached_servers_parse(), please see memcached(). like genuinely please see it, this one's old news πŸ™ˆ

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 it says "to to", we're keeping it, it's part of the lore πŸŽ€

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. glow-up arc fr fr 🌈⭐


πŸ”₯ RETURN VALUE πŸ”₯

Varies, see particular functions. yeah that's the whole thing, it's giving mysterious main character energy, go read the individual functions bestie πŸ‘‘


🌈 SEE ALSO 🌈


and that's the page!! πŸŽ€ this was libmemcached-awesome, version 1.1, dated Jul 24, 2025 β€” go forth and free your server lists responsibly, mwah πŸ’‹βœ¨πŸ’–

πŸ“¦ where this page comes from