redis(config)或dynomite(config)中是否有任何选项,只允许指定的键前缀列表?
例如
list-of-key-prefix : ["abc","xyz"]
然后只允许存储来自给定列表的前缀的密钥,而不会存储所有其他密钥?
例如
keys_allowed : ["abc_cow", "abcdog", "xyzcat", "xyzrat"]
keys_not_allowed : ["animal-cat","doganimal"]
答案 0 :(得分:-1)
您可以为此任务实现一个简单的python脚本,下面是示例代码段:
prefix_list=['abc', 'xyz']
keys=["abc_cow", "abcdog", "xyzcat", "xyzrat", "animal-cat","doganimal"]
for key in keys:
if key.startswith(perfix_list[0]) or key.startswith(perfix_list[1]):
#store key refer: https://github.com/andymccurdy/redis-py
else:
print "Key not staisfy prefix List"