Please note, this is a STATIC archive of website www.javatpoint.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
Javatpoint Logo
Javatpoint Logo

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.

Syntax:

Here,

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.

Return Value:

flush_all command always returns OK.

Example in Ubuntu:

Memcached Clear Data

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.

Memcached Server

Memcached Clear Data

Memcached Client:

Memcached Clear Data

Clear Data using Java Application

To clear data from the Memcached server, java provides a Memcached flush method.

Example:

Output:

Connection to server successfully
set status:true
Get from Cache:5
Increment value:7
Decrement value:6
Get from Cache:6
Clear data:true






Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA