3 memcached_return
memcached_flush(memcached_st
*ptr
, time_t expiration
)
8 char buffer
[MEMCACHED_DEFAULT_COMMAND_SIZE
];
9 LIBMEMCACHED_MEMCACHED_FLUSH_START();
11 rc
= memcached_connect(ptr
, 0);
13 if (rc
== MEMCACHED_NO_SERVERS
)
16 if (rc
!= MEMCACHED_SUCCESS
)
17 rc
= MEMCACHED_SOME_ERRORS
;
19 for (x
= 0; x
< ptr
->number_of_hosts
; x
++)
22 send_length
= snprintf(buffer
, MEMCACHED_DEFAULT_COMMAND_SIZE
,
23 "flush_all %llu\r\n", (unsigned long long)expiration
);
25 send_length
= snprintf(buffer
, MEMCACHED_DEFAULT_COMMAND_SIZE
,
28 if (send_length
>= MEMCACHED_DEFAULT_COMMAND_SIZE
)
29 return MEMCACHED_WRITE_FAILURE
;
31 rc
= memcached_do(ptr
, x
, buffer
, send_length
, 1);
32 if (rc
!= MEMCACHED_SUCCESS
)
35 rc
= memcached_response(ptr
, buffer
, MEMCACHED_DEFAULT_COMMAND_SIZE
, x
);
37 if (rc
!= MEMCACHED_SUCCESS
)
38 rc
= MEMCACHED_SOME_ERRORS
;
42 LIBMEMCACHED_MEMCACHED_FLUSH_END();