1MEMCACHED_STAT(3)            libmemcached-awesome            MEMCACHED_STAT(3)
2
3
4

NAME

6       memcached_stat - libmemcached Documentation
7
8       Get memcached statistics
9

SYNOPSIS

11       #include <libmemcached/memcached.h>
12              Compile and link with -lmemcached
13
14       typedef struct memcached_stat_st memcached_stat_st
15
16       typedef   memcached_return_t  (*memcached_stat_fn)(const  memcached_in‐
17       stance_st *server, const  char  *key,  size_t  key_length,  const  char
18       *value, size_t value_length, void *context)
19
20              Parameters
21
22server  --  pointer  to the memcached_instance_st being
23                       stat'ed
24
25key -- the current key
26
27key_length -- the length of the key without any  termi‐
28                       nating zero
29
30value -- the value read
31
32value_length  --  the  length  of the value without any
33                       terminating zero
34
35context -- pointer to the user supplied context
36
37              Returns
38                     memcached_return_t indicating success
39
40       memcached_stat_st *memcached_stat(memcached_st *ptr, char  *args,  mem‐
41       cached_return_t *error)
42
43              Parameters
44
45ptr -- pointer to an initialized memcached_st struct
46
47args -- particular state object to query
48
49error  -- pointer to memcached_return_t indicating suc‐
50                       cess
51
52              Returns
53                     array of  memcached_stat_st  objects  for  all  available
54                     servers
55
56       memcached_return_t  memcached_stat_servername(memcached_stat_st  *stat,
57       char *args, const char *hostname, in_port_t port)
58
59              Parameters
60
61stat -- pointer to a memcached_stat_st struct to fill
62
63args -- particular state object to query
64
65hostname -- the hostname or IP address of the server to
66                       stat
67
68port -- the port of the server to stat
69
70              Returns
71                     memcached_return_t indicating success
72
73       char   *memcached_stat_get_value(memcached_st  *ptr,  memcached_stat_st
74       *stat, const char *key, memcached_return_t *error)
75
76              Parameters
77
78ptr -- pointer to initialized memcached_st struct
79
80stat -- pointer to initialized memcached_stat_st struct
81
82key -- the statistic to query
83
84error -- pointer to memcached_return_t indicating  suc‐
85                       cess
86
87              Returns
88                     string value of the statistic
89
90       char   **memcached_stat_get_keys(memcached_st  *ptr,  memcached_stat_st
91       *stat, memcached_return_t *error)
92
93              Parameters
94
95ptr -- pointer to initialized memcached_st struct
96
97stat -- pointer to initialized memcached_stat_st struct
98
99error -- pointer to memcached_return_t indicating  suc‐
100                       cess
101
102              Returns
103                     array  of  default keys probably available in the statis‐
104                     tics
105
106       memcached_return_t memcached_stat_execute(memcached_st *ptr, const char
107       *args, memcached_stat_fn func, void *context)
108
109              Parameters
110
111ptr -- pointer to initialized memcached_st struct
112
113args -- particular state object to query
114
115func -- memcached_stat_fn callback
116
117context -- pointer to user supplied context
118
119              Returns
120                     memcached_return_t indication success
121

DESCRIPTION

123       libmemcached has the ability to query a memcached(1) server (or collec‐
124       tion of servers) for their current state. Queries to find state  return
125       a  memcached_stat_st  structure.  You  are responsible for freeing this
126       structure. While it is possible to access the structure directly it  is
127       not  advisable.  memcached_stat_get_value()  has been provided to query
128       the structure.
129
130       memcached_stat_execute() uses the servers  found  in  memcached_stat_st
131       and executes a "stat" command on each server. args is an optional argu‐
132       ment that can be passed in to modify the behavior of "stats". You  will
133       need  to  supply a callback function that will be supplied each pair of
134       values returned by the memcached server.
135
136       memcached_stat() fetches an array of memcached_stat_st structures  con‐
137       taining  the state of all available memcached servers. The return value
138       must be freed by the calling  application.  If  called  with  the  MEM‐
139       CACHED_BEHAVIOR_USE_UDP  behavior set, a NULL value is returned and the
140       error parameter is set to MEMCACHED_NOT_SUPPORTED.
141
142       memcached_stat_servername() can  be  used  standalone  without  a  mem‐
143       cached_st  to  obtain the state of a particular server.  "args" is used
144       to define a particular state object (a list of these are  not  provided
145       for  by  either the memcached_stat_get_keys() call nor are they defined
146       in the memcached protocol). You must specify the hostname and  port  of
147       the server you want to obtain information on.
148
149       memcached_stat_get_value() returns the value of a particular state key.
150       You specify the key you wish to obtain.  The key must  be  null  termi‐
151       nated.
152
153       memcached_stat_get_keys()  returns  a  list of keys that the server has
154       state objects on. You are responsible for freeing this list.
155
156       A command line tool, memstat, is provided so that you do  not  have  to
157       write an application to do this.
158

RETURN VALUE

160       Varies, see particular functions.
161
162       Any method returning a memcached_stat_st expects you to free the memory
163       allocated for it.
164

SEE ALSO

166       memcached(1) libmemcached(3) memcached_strerror(3)
167
168
169
170
1711.1                              Sep 20, 2021                MEMCACHED_STAT(3)
Impressum