FLUSHDB
Delete all the keys of the currently selected DB. This command never fails.
By default, FLUSHDB will synchronously flush all keys from the database. Starting with Redis 6.2, setting the lazyfree-lazy-user-flush configuration directive to “yes” changes the default flush mode to asynchronous.
Syntax
FLUSHDB [ASYNC | SYNC]
Time complexity:
O(N) where N is the number of keys in the selected database
Complete Guide to Redis Commands
Redis is an open-source, advanced key-value store and an apt solution for building high-performance, scalable web applications. Redis has three main peculiarities that set it apart:
- Redis holds its database entirely in the memory, using the disk only for persistence.
- Redis has a relatively rich set of data types compared to many key-value data stores.
- Redis can replicate data to any number of slaves.
Table of Content
- 1. KEY-VALUE OPERATIONS
- 1.1) SET:
- 1.2) GET:
- 1.4) DEL:
- 1.4) EXISTS:
- 1.5) TTL:
- 1.6) EXPIRE :
- 1.7) INCR
- 1.8) DECR
- 1.9) APPEND
- 2. LISTS:
- 2.1) LPUSH
- 2.2) RPUSH
- 2.3) LPOP
- 2.4) RPOP
- 2.5) LLEN
- 2.5) LRANGE
- 3. SETS:
- 3.1) “sadd” command:
- 3.2) “smembers” command:
- 3.3) “scard” command:
- 3.4) “sismember” command:
- 3.5) “sdiff” command:
- 3.6) “sdiffstore” command:
- 3.7) “sinter” command:
- 3.8) “sinterstore” command:
- 3.9) “sunion” command:
- 3.10) “sunionstore” command:
- 3.11) “srem” command:
- 4. HASHES:
- 4.1) HSET (Hash Set):
- 4.2) HGET (Hash Get):
- 4.3) HDEL (Hash Delete):
- 4.4) HGETALL (Hash Get All):
- 4.5) HKEYS (Hash Keys):
- 4.6) HVALS (Hash Values):
- 5. PUB/SUB:
- 5.1) PUBLISH
- 5.2) SUBSCRIBE
- 5.3) UNSUBSCRIBE
- 6. OTHER COMMANDS:
- 6.1) SELECT
- 6.2) FLUSHDB
- 6.3) SAVE
- 6.4) BGSAVE
Contact Us