Memcached Clear Data
Memcached flush_all command is used to clear all the data (i.e. key value pairs) from the Memcached server. Means, this command invalidates all existing cache items. It accepts an optional parameter, which means to invalidate all items after N seconds have passed.
flush_all does not pause the server, as it returns immediately. It does not free up or flush memory at all, it simply causes all items to expire.
time: It is an optional parameter. This parameter sets a time after which the Memcached data is to be cleared.
noreply: It is an optional parameter. It is used to inform the server not to send any reply.
flush_all command always returns OK.
Example in Ubuntu:
Example in Windows
Let's see an example, first of all we will store some data into the Memcached server and then clear all the data.
Clear Data using Java Application
To clear data from the Memcached server, java provides a Memcached flush method.
Connection to server successfully set status:true Get from Cache:5 Increment value:7 Decrement value:6 Get from Cache:6 Clear data:true