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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.