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

NAME

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

DESCRIPTION

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

RETURN VALUE

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

SEE ALSO

167       memcached(1) libmemcached(3) memcached_strerror(3)
168
169
170
171
1721.1                              Mar 06, 2023        MEMCACHED_STAT_EXECUTE(3)
Impressum