ソートされたセット、リスト、およびハッシュを使用する場合、特定の意味はありません。
uuidは、次のような文字列として保存できます。
110E8400-E29B-11D4-A716-446655440000
その場合、値ごとに38バイトかかります。人間が読める形式の値を保存する必要がない場合は、Redis機能を利用してバイナリデータ(キーと値の両方)を保存し、uuidを16バイトのみとして保存することをお勧めします。
ショートリスト、ソートされたセット、ハッシュは、Redisのドキュメントで説明されているようにシリアル化されます。次のパラメーターを微調整して、Redisの動作をワークロードに合わせて調整することをお勧めします。
# Hashes are encoded using a memory efficient data structure when they have a
# small number of entries, and the biggest entry does not exceed a given
# threshold. These thresholds can be configured using the following directives.
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
# Similarly to hashes, small lists are also encoded in a special way in order
# to save a lot of space. The special representation is only used when
# you are under the following limits:
list-max-ziplist-entries 512
list-max-ziplist-value 64
# Sets have a special encoding in just one case: when a set is composed
# of just strings that happens to be integers in radix 10 in the range
# of 64 bit signed integers.
# The following configuration setting sets the limit in the size of the
# set in order to use this special memory saving encoding.
set-max-intset-entries 512
# Similarly to hashes and lists, sorted sets are also specially encoded in
# order to save a lot of space. This encoding is only used when the length and
# elements of a sorted set are below the following limits:
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
セット(ソートされたセットではなく単純なセット)を使用する場合は、intsetと呼ばれる特定の最適化があり、UUIDをキーとして使用してもメリットはありません。intsetは64ビットの数値をエンコードするためにのみ使用できるため、16バイトのUUIDは適合しません。多数のセットを格納する場合は、間接参照を追加し、UUIDの代わりに整数を主キーとして使用すると便利な場合があります。そうでなければそれは無意味です。