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 memset(buffer
, 0, MEMCACHED_DEFAULT_COMMAND_SIZE
);
20 for (x
= 0; x
< ptr
->number_of_hosts
; x
++)
23 send_length
= snprintf(buffer
, MEMCACHED_DEFAULT_COMMAND_SIZE
,
24 "flush_all %llu\r\n", (unsigned long long)expiration
);
26 send_length
= snprintf(buffer
, MEMCACHED_DEFAULT_COMMAND_SIZE
,
29 if (send_length
>= MEMCACHED_DEFAULT_COMMAND_SIZE
)
30 return MEMCACHED_WRITE_FAILURE
;
32 rc
= memcached_do(ptr
, x
, buffer
, send_length
, 1);
33 if (rc
!= MEMCACHED_SUCCESS
)
36 rc
= memcached_response(ptr
, buffer
, MEMCACHED_DEFAULT_COMMAND_SIZE
, x
);
38 if (rc
!= MEMCACHED_SUCCESS
)
39 rc
= MEMCACHED_SOME_ERRORS
;
43 LIBMEMCACHED_MEMCACHED_FLUSH_END();