Skip to content

Commit

Permalink
redis in day 1 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
seebham committed Sep 5, 2021
1 parent b728faf commit f44b044
Showing 1 changed file with 87 additions and 0 deletions.
87 changes: 87 additions & 0 deletions Day_01/RedisCommands.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Redis CLI Commands learnt in Day 1

1. SET key value
```
SET name Shubham
```
2. EXISTS key
```
EXISTS name
```
3. KEYS \* - To get all the keys
```
KEYS *
```
4. FLUSHALL - to flush all the keys
```
FLUSHALL
```
5. DEl key - to delete a key
```
DEL name
```
6. EXPIRE key seconds - (-1) when no expiry is set or (-2) when the key is expired
```
EXPIRE name 10
```
7. TTL key - Time To Live
```
TTL name
```
8. SETEX key seconds value - Set a key: value with an expiry
```
SETEX name 10 Shubham
```

## Arrays

9. LPUSH key element - to push an element at the start of the array
```
LPUSH array 1
```
10. RPUSH key element - to push an element at the end of the array
```
RPUSH array 2
```
11. LRANGE key start stop - to iterate the array
```
LRANGE array 0 -1
```
12. LPOP key - remove an element from the left side
```
LPOP array
```
13. RPOP key - remove an element from the right side
```
RPOP array
```
## Sets
14. SADD key member
```
SADD hobbies "Computer Gaming"
```
## Objects
15. HSET key field value - Set an Object (Hash)
```
HSET persom name Shubham
```
16. HGET key field - Get the value of the field in the object
```
HGET person name
```
17. HGETALL key - get all the key:values from the object
```
HGETALL person
```
18. HDEL key field - delete a field from the object
```
HDEL person name
```
19. HEXISTS key field - check where the field exists in the object
```
HEXISTS person name
```

0 comments on commit f44b044

Please sign in to comment.