memcached  1.6.9
About: memcached is a high-performance, distributed memory object caching system, generic in nature, but originally intended for use in speeding up dynamic web applications by alleviating database load.
  Fossies Dox: memcached-1.6.9.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

items.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  lru_pull_tail_return
struct  item_stats_automove


#define HOT_LRU   0
#define WARM_LRU   64
#define COLD_LRU   128
#define TEMP_LRU   192
#define CLEAR_LRU(id)   (id & ~(3<<6))
#define GET_LRU(id)   (id & (3<<6))
#define LRU_PULL_EVICT   1
#define LRU_PULL_RETURN_ITEM   4 /* fill info struct if available */


uint64_t get_cas_id (void)
void set_cas_id (uint64_t new_cas)
itemdo_item_alloc (char *key, const size_t nkey, const unsigned int flags, const rel_time_t exptime, const int nbytes)
item_chunkdo_item_alloc_chunk (item_chunk *ch, const size_t bytes_remain)
itemdo_item_alloc_pull (const size_t ntotal, const unsigned int id)
void item_free (item *it)
bool item_size_ok (const size_t nkey, const int flags, const int nbytes)
int do_item_link (item *it, const uint32_t hv)
void do_item_unlink (item *it, const uint32_t hv)
void do_item_unlink_nolock (item *it, const uint32_t hv)
void do_item_remove (item *it)
void do_item_update (item *it)
void do_item_update_nolock (item *it)
int do_item_replace (item *it, item *new_it, const uint32_t hv)
void do_item_link_fixup (item *it)
int item_is_flushed (item *it)
unsigned int do_get_lru_size (uint32_t id)
void do_item_linktail_q (item *it)
void do_item_unlinktail_q (item *it)
itemdo_item_crawl_q (item *it)
voiditem_lru_bump_buf_create (void)
int lru_pull_tail (const int orig_id, const int cur_lru, const uint64_t total_bytes, const uint8_t flags, const rel_time_t max_age, struct lru_pull_tail_return *ret_it)
char * item_cachedump (const unsigned int slabs_clsid, const unsigned int limit, unsigned int *bytes)
void item_stats (ADD_STAT add_stats, void *c)
void do_item_stats_add_crawl (const int i, const uint64_t reclaimed, const uint64_t unfetched, const uint64_t checked)
void item_stats_totals (ADD_STAT add_stats, void *c)
void item_stats_sizes (ADD_STAT add_stats, void *c)
void item_stats_sizes_init (void)
void item_stats_sizes_enable (ADD_STAT add_stats, void *c)
void item_stats_sizes_disable (ADD_STAT add_stats, void *c)
void item_stats_sizes_add (item *it)
void item_stats_sizes_remove (item *it)
bool item_stats_sizes_status (void)
void fill_item_stats_automove (item_stats_automove *am)
itemdo_item_get (const char *key, const size_t nkey, const uint32_t hv, conn *c, const bool do_update)
itemdo_item_touch (const char *key, const size_t nkey, uint32_t exptime, const uint32_t hv, conn *c)
void do_item_bump (conn *c, item *it, const uint32_t hv)
void item_stats_reset (void)
int start_lru_maintainer_thread (void *arg)
int stop_lru_maintainer_thread (void)
int init_lru_maintainer (void)
void lru_maintainer_pause (void)
void lru_maintainer_resume (void)
voidlru_bump_buf_create (void)


pthread_mutex_t lru_locks [POWER_LARGEST]

Macro Definition Documentation


#define CLEAR_LRU (   id)    (id & ~(3<<6))

Definition at line 6 of file items.h.


#define COLD_LRU   128

Definition at line 3 of file items.h.


#define GET_LRU (   id)    (id & (3<<6))

Definition at line 7 of file items.h.


#define HOT_LRU   0

Definition at line 1 of file items.h.



Definition at line 39 of file items.h.


#define LRU_PULL_EVICT   1

Definition at line 38 of file items.h.


#define LRU_PULL_RETURN_ITEM   4 /* fill info struct if available */

Definition at line 40 of file items.h.


#define TEMP_LRU   192

Definition at line 4 of file items.h.


#define WARM_LRU   64

Definition at line 2 of file items.h.

Function Documentation

◆ do_get_lru_size()

unsigned int do_get_lru_size ( uint32_t  id)

Definition at line 139 of file items.c.

References sizes.

Referenced by do_lru_crawler_start().

◆ do_item_alloc()

◆ do_item_alloc_chunk()

◆ do_item_alloc_pull()

item* do_item_alloc_pull ( const size_t  ntotal,
const unsigned int  id 

◆ do_item_bump()

◆ do_item_crawl_q()

item* do_item_crawl_q ( item it)

◆ do_item_get()

item* do_item_get ( const char *  key,
const size_t  nkey,
const uint32_t  hv,
conn c,
const bool  do_update 

◆ do_item_link()

◆ do_item_link_fixup()

◆ do_item_linktail_q()

void do_item_linktail_q ( item it)

◆ do_item_remove()

◆ do_item_replace()

int do_item_replace ( item it,
item new_it,
const uint32_t  hv 

◆ do_item_stats_add_crawl()

void do_item_stats_add_crawl ( const int  i,
const uint64_t  reclaimed,
const uint64_t  unfetched,
const uint64_t  checked 

◆ do_item_touch()

item* do_item_touch ( const char *  key,
const size_t  nkey,
uint32_t  exptime,
const uint32_t  hv,
conn c 

Definition at line 1067 of file items.c.

References do_item_get(), DO_UPDATE, and _stritem::exptime.

Referenced by item_touch().

◆ do_item_unlink()

◆ do_item_unlink_nolock()

◆ do_item_unlinktail_q()

void do_item_unlinktail_q ( item it)

Definition at line 1751 of file items.c.

References heads, _stritem::next, _stritem::prev, _stritem::slabs_clsid, and tails.

Referenced by lru_crawler_class_done().

◆ do_item_update()

◆ do_item_update_nolock()

void do_item_update_nolock ( item it)

update LRU time to current and reposition

◆ fill_item_stats_automove()

◆ get_cas_id()

uint64_t get_cas_id ( void  )

◆ init_lru_maintainer()

int init_lru_maintainer ( void  )

Definition at line 1724 of file items.c.

References lru_maintainer_initialized.

Referenced by main().

◆ item_cachedump()

char* item_cachedump ( const unsigned int  slabs_clsid,
const unsigned int  limit,
unsigned int *  bytes 

◆ item_free()

◆ item_is_flushed()

◆ item_lru_bump_buf_create()

void* item_lru_bump_buf_create ( void  )

◆ item_size_ok()

bool item_size_ok ( const size_t  nkey,
const int  flags,
const int  nbytes 

Returns true if an item will fit in the cache (its size does not exceed the maximum for a cache entry.)

Definition at line 366 of file items.c.

References item_make_header(), slabs_clsid(), and settings::use_cas.

Referenced by process_bin_append_prepend(), process_bin_update(), process_mset_command(), and process_update_command().

◆ item_stats()

◆ item_stats_reset()

void item_stats_reset ( void  )

Definition at line 71 of file items.c.

References itemstats, LARGEST_ID, and lru_locks.

Referenced by stats_reset().

◆ item_stats_sizes()

void item_stats_sizes ( ADD_STAT  add_stats,
void c 

dumps out a list of objects of each size, with granularity of 32 bytes

Definition at line 934 of file items.c.

References APPEND_STAT, mutex_lock, mutex_unlock, stats_sizes_buckets, stats_sizes_hist, and stats_sizes_lock.

Referenced by get_stats().

◆ item_stats_sizes_add()

void item_stats_sizes_add ( item it)

◆ item_stats_sizes_disable()

void item_stats_sizes_disable ( ADD_STAT  add_stats,
void c 

Definition at line 897 of file items.c.

References APPEND_STAT, mutex_lock, mutex_unlock, stats_sizes_hist, and stats_sizes_lock.

Referenced by get_stats().

◆ item_stats_sizes_enable()

void item_stats_sizes_enable ( ADD_STAT  add_stats,
void c 

◆ item_stats_sizes_init()

void item_stats_sizes_init ( void  )

◆ item_stats_sizes_remove()

void item_stats_sizes_remove ( item it)

◆ item_stats_sizes_status()

bool item_stats_sizes_status ( void  )

Definition at line 861 of file items.c.

References mutex_lock, mutex_unlock, stats_sizes_hist, and stats_sizes_lock.

Referenced by process_stat_settings().

◆ item_stats_totals()

◆ lru_bump_buf_create()

void* lru_bump_buf_create ( void  )

◆ lru_maintainer_pause()

void lru_maintainer_pause ( void  )

Definition at line 1716 of file items.c.

References lru_maintainer_lock.

Referenced by pause_threads().

◆ lru_maintainer_resume()

void lru_maintainer_resume ( void  )

Definition at line 1720 of file items.c.

References lru_maintainer_lock.

Referenced by pause_threads().

◆ lru_pull_tail()

◆ set_cas_id()

void set_cas_id ( uint64_t  new_cas)

Definition at line 119 of file items.c.

References cas_id, and cas_id_lock.

Referenced by _mc_meta_load_cb().

◆ start_lru_maintainer_thread()

int start_lru_maintainer_thread ( void arg)

◆ stop_lru_maintainer_thread()

int stop_lru_maintainer_thread ( void  )

Variable Documentation

◆ lru_locks