当前位置:网站首页>Redis learning notes - Database Management

Redis learning notes - Database Management

2022-06-23 09:10:00 Love Guoba

Switch receipt Library

select dbindex

MySQL Support the existence of multiple databases under one instance , But relational databases use characters to distinguish different database names ,Redis Use only numbers to distinguish between different databases ,redis The default is 16 A database , stay redis.conf The configuration file has a default configuration databases 16. In general, it is not recommended to use multiple databases to manage the cache , such as Redis Distributed implementation of Redis Cluster Only use 0 The database , If you want to use multiple databases, it is best to arrange multiple databases redis Instances are distinguished by ports , With all instances of 0 The database , Try not to switch databases , So as not to be difficult to maintain

stay 14 No. database settings key by Charlie The data of , Data in other databases are not interconnected

127.0.0.1:6379> get Charlie
(nil)
127.0.0.1:6379> select 14
OK
127.0.0.1:6379[14]> set Charlie "I'm tired"
OK
127.0.0.1:6379[14]> select 0
OK
127.0.0.1:6379> get Charlie
(nil)

Clear data

flushdb/flushall Clear the warehouse carefully

flushdb
flushall
原网站

版权声明
本文为[Love Guoba]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/174/202206230900185233.html