比如在一个db里,有一堆键为topic:xxxxxx和user:xxxxxx的值,而如果我只想让所有的user:xxxxxx失效,有什么办法吗?
topic:xxxxxx
user:xxxxxx
这是一个很常见的应用场景,比如user:xxxxxx对应的表结构改变了,需要重新缓存,而我不希望影响其他的数据。
我想到的是用KEYS user:*命令来遍历所有符合条件的数据。但是这个命令太耗资源了,有什么其它办法吗?
KEYS user:*
光阴似箭催人老,日月如移越少年。
user的所有键的ID should be put into a list for management, so that it is easy to read
user
ID
Shouldn’t this kind of data be stored in a hash type?
user
的所有键的ID
should be put into a list for management, so that it is easy to readShouldn’t this kind of data be stored in a hash type?