Does name length impact performance in Redis?

后端 未结 4 2040
忘掉有多难
忘掉有多难 2020-12-22 18:41

I like to use verbose names in Redis, for instance set-allBooksBelongToUser:$userId.

Is this ok or does that impact performance?

4条回答
  •  抹茶落季
    2020-12-22 19:14

    Redis likes to hold all keys in memory. The longer your average key length, the less can be held in memory. So yes, key length can greatly impact performance but probably not significantly in the way you are concerned. That is, with a small keyspace (e.g. one that fits easily in memory), a 128 byte key and a 16 byte key won't perform dramatically differently.

提交回复
热议问题