memcached icon indicating copy to clipboard operation
memcached copied to clipboard

The <delay> option of flush_all command might have a negative value. It's operation is undefined.

Open jhpark816 opened this issue 14 years ago • 0 comments

The flush_all command has "delay" option, whose value might be a negative integer. In that case, the correct operation of flush_all is not defined. I think, immediate invalidation might be proper in that case..

Just for your reference, google's memcached-1.4.5 performs immediate invalidation in case that "delay" option has a negative value..

So, following code update is needed in your engine branch.


void item_flush_expired(struct default_engine *engine, time_t when) {
    . . .


#if 1 // NEW CODE
    if (when <= 0) { // In case that the value of "delay" is 0 or a negative value.
#else // OLD CODE
    if (when == 0) {
#endif
        engine->config.oldest_live = engine->server.core->get_current_time() - 1;
    } else {
        engine->config.oldest_live = engine->server.core->realtime(when) - 1;
    }

    . . .
}

jhpark816 avatar Jan 18 '11 06:01 jhpark816