flush_all functionality at given time
liz at dijkmat.nl
Wed Aug 10 00:58:04 PDT 2005
At 8:27 AM +0100 8/10/05, Alex Stapleton wrote:
>On 10 Aug 2005, at 07:01, Brad Fitzpatrick wrote:
>>Checked in to cvs. Thanks!
>>On Wed, 6 Jul 2005, Elizabeth Mattijsen wrote:
>>>Because I needed a way to flush all memcached backend servers, but
>>>not at exactly the same time (to reduce load peaks), I've added some
>>>simple functionality to the memcached protocol in the "flush_all"
>>>command that allows you to specify a time at which the flush will
>>>actually occur (instead of always at the moment the "flush_all"
>>>command is received).
>>>So, apart from just "flush_all", you can now also specify an
>>>expiration for the flush to occur.
>>>flush_all\r\n // flushes now
>>>flush_all 10\r\n // flushes in 10 seconds
>>>flush_all 1120673174\r\n // flushes at Wed Jul 6 18:06:14 2005 GMT
>How do you differentiate from "in 10 seconds" and a full UNIX Time stamp?
The same way all expiration specifications are handled. From doc/protocol.txt:
Some commands involve a client sending some kind of expiration time
(relative to an item or to an operation requested by the client) to
the server. In all such cases, the actual value sent may either be
Unix time (number of seconds since January 1, 1970, as a 32-bit
value), or a number of seconds starting from current time. In the
latter case, this number of seconds may not exceed 60*60*24*30 (number
of seconds in 30 days); if the number sent by a client is larger than
that, the server will consider it to be real Unix time value rather
than an offset from current time.
if you look at the source, it's the "realtime()" function.
More information about the memcached