There's more...

HLL is actually stored as string, and it's easy to persist and restore for key-value pairs.

For your reference, HLL in Redis uses two presentations internally to store HLL objects:

  • Sparse: For an HLL object whose length is less than hll-sparse-max-bytes (default: 3000) in configuration. Sparse representation is more space efficient, while it may cost more CPU in Redis.
  • Dense: The default encoding when sparse encoding cannot be used per configuration.

Get Redis 4.x Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.