Memcac...ed_pool(3pm)

✨ NAME ✨

ok so this is Memcac...ed_pool from the 3pm manual, and it's literally the pool-management era β€” memcached_pool_create, memcached_pool_destroy, memcached_pool_push, memcached_pool_pop β€” all about managing pools πŸ’–


πŸ“š LIBRARY πŸ“š

C Client Library for memcached (libmemcachedutil, -lmemcachedutil) β€” yes bestie that's the whole vibe, linking against that util lib 🫢


🌸 SYNOPSIS 🌸

okay here's the whole cast list, copied exactly, no edits, we do not touch the code:

#include <libmemcached/memcached_pool.h>

memcached_pool_st *
  memcached_pool_create(memcached_st* mmc, int initial, int max);

memcached_st *
  memcached_pool_destroy(memcached_pool_st* pool);

memcached_st *
  memcached_pool_pop (memcached_pool_st* pool, bool block, memcached_return_t *rc);

memcached_return_t
  memcached_pool_push(memcached_pool_st* pool, memcached_st *mmc);

memcached_st *memcached_create (memcached_st *ptr);

memcached_return_t
  memcached_pool_behavior_set(memcached_pool_st *pool,
                              memcached_behavior_t flag,
                              uint64_t data)

memcached_return_t
  memcached_pool_behavior_get(memcached_pool_st *pool,
                              memcached_behavior_t flag,
                              uint64_t *value)

πŸ’… DESCRIPTION πŸ’…

the pool creation moment ✨

memcached_pool_create() is the one that makes you a whole connection pool of objects, and the entire reason you'd wanna do that is to remove the overhead of using memcached_clone for short lived "memcached_st" objects. no cap, that's the point.

  • the mmc argument should be an initialised "memcached_st" structure, and a successfull invocation of memcached_pool_create takes full ownership of the variable β€” like, it's theirs now πŸ‘‘ β€” until it's released by memcached_pool_destroy.
  • the initial argument specifies the initial size of the connection pool.
  • the max argument specifies the maximum size the connection pool should grow to.
⚠️ please note bestie: the library will allocate a fixed size buffer scaled to the max size of the connection pool, so you should not pass MAXINT or some other large number here. that's not a vibe check, that's a real warning 😭

the pool destruction moment πŸ’€

memcached_pool_destroy() destroys the connection pool created with memcached_pool_create() and releases all allocated resources. It will return the pointer to the "memcached_st" structure passed as an argument to memcached_pool_create(), and returns the ownership of the pointer to the caller. giving it back, we love a clean handoff πŸŽ€

the grabbing moment 🫢

memcached_pool_pop() grabs a connection structure from the connection pool. The block argument specifies if the function should block and wait for a connection structure to be available if we try to exceed the maximum size. patient queen energy, or nah, your call ✨

the giving-back moment 🌈

memcached_pool_push() returns a connection structure back to the pool. returning what you borrowed, iconic behaviour, periodt πŸ’–

the behavior moment 🧚

memcached_pool_behavior_set() and memcached_pool_behagior_get() is used to get/set behavior flags on all connections in the pool. (yes, that's the spelling in the original, i am not touching it, it's part of the lore πŸ“)


πŸ”₯ RETURN πŸ”₯

  • memcached_pool_create() returns a pointer to the newly created memcached_pool_st structure. On an allocation failure, it returns NULL. (sad. tragic. moving on πŸ’”)
  • memcached_pool_destroy() returns the pointer (and ownership) to the memcached_st structure used to create the pool. If connections are in use it returns NULL.
  • memcached_pool_pop() returns a pointer to a memcached_st structure from the pool (or NULL if an allocation cannot be satisfied).
  • memcached_pool_push() returns MEMCACHED_SUCCESS upon success.
  • memcached_pool_behavior_get() and memcached_pool_behavior_get() returns MEMCACHED_SUCCESS upon success.

🏠 HOME 🏠

To find out more information please check: <https://launchpad.net/libmemcached>

go touch grass on launchpad, iykyk πŸ¦‹


πŸ‘‘ AUTHOR πŸ‘‘

Trond Norbye, <trond.norbye@gmail.com>


🌟 SEE ALSO 🌟

memcached(1) libmemcached(3) memcached_create(3) memcached_free(3) libmemcachedutil(3) memcached_behavior_get(3) memcached_behavior_set(3)


and that's the whole page bestie, no notes πŸ’œ β€” this was Memcac...ed_pool(3pm) from perl v5.42.3, dated 2026-08-19, signed off with love and at least three exclamation points πŸŽ€βœ¨

πŸ“¦ where this page comes from