I find this feature a must have ! Currently, if you need for any reason to ensure your cache only contains fresh data (say for the final phase of a modification in your data format), you have to possibilities: - having set a TTL when updating items in your application at the very first version, and never having removed it, and wait this TTL with the new version running - do a full flush, which means having a "memcached outage"
Moreover, current behaviour of TTL in flush is really misleading. Judging by the behavior of TTL in update/set/replace, you would say the TTL means items not updated since TTL will be deleted (i.e. the same feature Jean-Charles done, but without the negativeness). In fact it's not the case. It's only a delay before the flush. If I want to flush in 10 s, I just do sleep 10 && memflush. From applicative side, it give flexibility as you don't have to fork or spawn to have the flush done later asynchronously, but I don't see the flush as an applicative feature, more an administrative operation. I agree that modifying the flush so that flush(10) remove all items not updated during the last 10 seconds would be violent as it would break compatibility. That's why I like the idea of using negative values. It remains logical (flush(-10) acts as if flush had been done 10 seconds ago) and compatible with old behaviour.
