3 memcached_return
memcached_flush(memcached_st
*ptr
, time_t expiration
)
8 char buffer
[MEMCACHED_DEFAULT_COMMAND_SIZE
];
10 rc
= memcached_connect(ptr
);
12 if (rc
!= MEMCACHED_SUCCESS
)
13 rc
= MEMCACHED_SOME_ERRORS
;
15 for (x
= 0; x
< ptr
->number_of_hosts
; x
++)
18 send_length
= snprintf(buffer
, MEMCACHED_DEFAULT_COMMAND_SIZE
,
19 "flush_all %u\r\n", expiration
);
21 send_length
= snprintf(buffer
, MEMCACHED_DEFAULT_COMMAND_SIZE
,
23 if ((send(ptr
->hosts
[x
].fd
, buffer
, send_length
, 0) == -1))
25 fprintf(stderr
, "failed flush_all TCP\n");
27 return MEMCACHED_WRITE_FAILURE
;
30 rc
= memcached_response(ptr
, buffer
, MEMCACHED_DEFAULT_COMMAND_SIZE
, x
);
32 if (rc
!= MEMCACHED_SUCCESS
)
33 rc
= MEMCACHED_SOME_ERRORS
;