针对哈希缓存用例优化Redis

时间:2020-05-31 10:35:55

标签: redis

我将Redis用作缓存。

我所有的数据都是16字节的哈希值。我想针对此用例优化Redis。

目前,我正在通过以下方式保存和获取哈希:

r.set(hash, b"A") # Sets hash in the cache
r.get(hash) # if result is not None, then I know that hash is in cache.

一些具体问题:

有没有一种方法可以在设置阶段不使用任意字节来节省空间?

是否有一种配置Redis的方式,以便我的所有数据都是16字节并以最佳方式保存?

欢迎其他任何提示。

0 个答案:

没有答案
相关问题