start up:
brew services start redis
stop
brew services stop redis
Login:
redis-cli -h 127.0.0.1
Select the database (16 in total, the 0th is selected by default):
select 1
View all keys:
keys *
Check if a key exists:
exists key
Delete a key:
del keyname
Check the type of a key:
type keyname
127.0.0.1:6379> type spring:session:sessions:79de7903-9b54-4eb3-b3de-0088f9a20792
hash
Get information about a value of this type:
hash: 127.0.0.1:6379> hgetall spring:session:sessions:79de7903-9b54-4eb3-b3de-0088f9a20792
string: 127.0.0.1:6379> get goods:001
Delete keys in batches:
Note: This command cannot be executed under the client , first use the exit command to exit the client!
redis-cli -h 127.0.0.1 keys "spring*" | xargs redis-cli -h 127.0.0.1
The above command sometimes does not work. . . You can try to clear the database, in the context of your own learning~
127.0.0.1:6379> fulshdb