Commands
>
FLUSH

FLUSH

Syntax

FLUSH [SYNC|ASYNC] [DELAY seconds]

Description

Clears the cache.

Options

  • SYNC - The client wait until the operation completes.
  • ASYNC - Returns immediately, while performing the operation in the background.
  • DELAY - Delays the operation for the provided seconds.

This operation marks all entries in the cache as being expired, but does not immediately free the memory belonging to those entries. The memory is freed when the key belonging to the old key is accessed or when the SWEEP command is explicitly called.

Example

> SET key1 value1
> SET key2 value2
> DBSIZE
> FLUSH
> DBSIZE

Related Commands