Dhananjay Patel Logo
  1. Home
  2. / Blog
  3. / Redis
  4. / Lessons
  5. / 1

Prev

Next

Basic Redis Commands

Terminal window
sudo service redis-server start
redis-cli
auth [username] [password]
Terminal window
set name dhananjay # set key value
set age 23 # get key
get name # "dhananjay"
get age # "23"
flushall # to clear the complete database
clear # to clear the terminal
setex name 20 dhananjay # setex key seconds value
ttl name # ttl: time to live (in sec.)
get name
flush all
hset person name dhananjay age 23
hget person name # "dhananjay"
hget person age # "23"
expire person 20 # expire key seconds
ttl person
hgetall person # name dhananay age 23
Terminal window
sudo nano /etc/redis/redis.conf
sudo redis-server /etc/redis/redis.conf

Prev

Next