9 static memcached_return_t
_set_verbosity(const memcached_st
*ptr
__attribute__((unused
)),
10 const memcached_server_st
*server
,
13 memcached_return_t rc
;
14 memcached_st local_memc
;
15 memcached_st
*memc_ptr
;
16 char buffer
[MEMCACHED_DEFAULT_COMMAND_SIZE
];
18 struct context_st
*execute
= (struct context_st
*)context
;
20 memc_ptr
= memcached_create(&local_memc
);
22 rc
= memcached_server_add(memc_ptr
, memcached_server_name(server
), memcached_server_port(server
));
24 if (rc
== MEMCACHED_SUCCESS
)
26 memcached_server_write_instance_st instance
=
27 memcached_server_instance_fetch(memc_ptr
, 0);
29 rc
= memcached_do(instance
, execute
->buffer
, execute
->length
, true);
31 if (rc
== MEMCACHED_SUCCESS
)
33 rc
= memcached_response(instance
, buffer
, MEMCACHED_DEFAULT_COMMAND_SIZE
, NULL
);
37 memcached_free(memc_ptr
);
42 memcached_return_t
memcached_verbosity(memcached_st
*ptr
, uint32_t verbosity
)
45 memcached_server_fn callbacks
[1];
47 char buffer
[MEMCACHED_DEFAULT_COMMAND_SIZE
];
49 send_length
= (size_t) snprintf(buffer
, MEMCACHED_DEFAULT_COMMAND_SIZE
,
50 "verbosity %u\r\n", verbosity
);
51 unlikely (send_length
>= MEMCACHED_DEFAULT_COMMAND_SIZE
)
52 return MEMCACHED_WRITE_FAILURE
;
54 struct context_st context
= { .length
= send_length
, .buffer
= buffer
};
56 callbacks
[0]= _set_verbosity
;
58 return memcached_server_cursor(ptr
, callbacks
, &context
, 1);