<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/valkey-introducing-hash-field-expirations-6fhgmvwab" -->

---
title: Valkey · Introducing Hash Field Expirations | daily.dev
description: Valkey 9.0 introduces per-field expiration for hash objects, letting developers set independent TTLs on individual fields within a hash rather than only at the...
canonical: https://daily.dev/posts/valkey-introducing-hash-field-expirations-6fhgmvwab
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Valkey · Introducing Hash Field Expirations | daily.dev
og:description: Valkey 9.0 introduces per-field expiration for hash objects, letting developers set independent TTLs on individual fields within a hash rather than only at the...
og:url: https://daily.dev/posts/valkey-introducing-hash-field-expirations-6fhgmvwab
og:image: https://api.daily.dev/og/posts/6FhgMVwAb.png
og:image:alt: Valkey · Introducing Hash Field Expirations
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Valkey · Introducing Hash Field Expirations

**[Valkey](https://daily.dev/sources/valkey-blog)** · 12 min read · 0 upvotes · 0 comments

## Summary

Valkey 9.0 introduces per-field expiration for hash objects, letting developers set independent TTLs on individual fields within a hash rather than only at the whole-key level. The team explains why lazy expiration was rejected for hash fields, walks through design alternatives (secondary hashtable, radix tree, skip list) and their memory tradeoffs, and describes the final 'coarse bucket with adaptive encoding' approach called a volatile set. Benchmarks show 16-29 bytes of memory overhead per expiring field, no measurable command performance regression, and predictable CPU-bounded active expiration even under heavy ingestion (300K commands/sec). New commands like HSETEX and HGETEX, compatible with the Redis 8.0 API, let clients set and refresh field-level TTLs, with practical examples for feature flags and link-metadata use cases via the valkey-glide 2.1.0 client.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://valkey.io/blog/hash-fields-expiration>

## Questions this post answers

### How do I set an expiration time on a single field inside a Valkey hash instead of the whole key?

Valkey 9.0 adds hash field expirations via new commands like HEXPIRE, HTTL, HEXPIRETIME, HSETEX, and HGETEX, letting you set a TTL on individual fields rather than the entire hash. For example, client.hexpire("User1", 60, ["password"]) expires just the password field after 60 seconds while other fields remain. The API is compatible with the Redis 8.0 API and supported by valkey-glide 2.1.0.

_daily.dev surfaces practical release notes like this for teams adopting new Valkey TTL features._

### How much memory overhead does per-field TTL tracking add in Valkey 9.0 hashes?

Per-field expiration overhead in Valkey 9.0 ranges between 16 and 29 bytes per field, depending on how many fields have TTLs and how spread out their expiration times are. The higher end mostly affects small hashes, since compact listpack encoding is avoided once volatile fields are present. Command throughput showed no measurable regression when expirations were added.

_Engineers evaluating Valkey's memory tradeoffs can track benchmarks like these on daily.dev._

### Why doesn't Valkey use lazy expiration for hash field TTLs the way it does for whole keys?

Valkey chose not to implement lazy expiration for hash fields because adding expiration checks to every HGET, HSET, or HDEL call would complicate the hot path of hash commands and risk performance regressions. Instead, the active expiration background job was extended to scan a new 'volatile set' structure tracking field-level expiration buckets alongside top-level keys.

_daily.dev helps engineers weighing expiration and caching design tradeoffs stay current on database internals._

## Similar posts on daily.dev

- [Announcing Valkey 9.1 for Amazon ElastiCache](https://daily.dev/posts/announcing-valkey-9-1-for-amazon-elasticache-pvemznhnh) · AWS Database Blog · 0 upvotes · 0 comments
- [Valkey 9.1 Delivers More Performance & Enhanced Security](https://daily.dev/posts/valkey-9-1-delivers-more-performance-enhanced-security-9lzgcvzst) · Phoronix · 0 upvotes · 0 comments
- [Memorystore for Valkey 9.0 is now GA](https://daily.dev/posts/memorystore-for-valkey-9-0-is-now-ga-rbykebtbw) · Google Cloud · 0 upvotes · 0 comments
- [Valkey Memory Optimization, Version by Version and Encoding: How Many Bytes Did Each Release Actually Save?](https://daily.dev/posts/valkey-memory-optimization-version-by-version-and-encoding-how-many-bytes-did-each-release-actuall-5irzo7vsj) · Percona Blog · 1 upvotes · 0 comments

---

Tags: [#backend](https://daily.dev/tags/backend), [#redis](https://daily.dev/tags/redis), [#data-structures](https://daily.dev/tags/data-structures), [#valkey](https://daily.dev/tags/valkey)

[View this post on daily.dev](https://daily.dev/posts/valkey-introducing-hash-field-expirations-6fhgmvwab)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Valkey · Introducing Hash Field Expirations","url":"https://daily.dev/posts/valkey-introducing-hash-field-expirations-6fhgmvwab","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/valkey-introducing-hash-field-expirations-6fhgmvwab"},"datePublished":"2026-08-23T12:23:16.611Z","dateModified":"2026-08-23T12:59:14.530Z","description":"Valkey 9.0 introduces per-field expiration for hash objects, letting developers set independent TTLs on individual fields within a hash rather than only at the...","image":"https://media.daily.dev/image/upload/s--CxzD6vbw--/f_auto/v1722860399/public/Placeholder%2005","thumbnailUrl":"https://media.daily.dev/image/upload/s--CxzD6vbw--/f_auto/v1722860399/public/Placeholder%2005","isAccessibleForFree":true,"articleSection":"Valkey","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Valkey","logo":"https://media.daily.dev/image/upload/s--XXPzEmD8--/f_auto,q_auto/v1787487496/logos/valkey-blog?_a=BAMAMicg0","url":"https://daily.dev/sources/valkey-blog"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/valkey-introducing-hash-field-expirations-6fhgmvwab","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"backend,redis,data-structures,valkey","timeRequired":"PT12M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Valkey","item":"https://daily.dev/sources/valkey-blog"},{"@type":"ListItem","position":3,"name":"Valkey · Introducing Hash Field Expirations"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/valkey-introducing-hash-field-expirations-6fhgmvwab#faq","mainEntity":[{"@type":"Question","name":"How do I set an expiration time on a single field inside a Valkey hash instead of the whole key?","acceptedAnswer":{"@type":"Answer","text":"Valkey 9.0 adds hash field expirations via new commands like HEXPIRE, HTTL, HEXPIRETIME, HSETEX, and HGETEX, letting you set a TTL on individual fields rather than the entire hash. For example, client.hexpire(\"User1\", 60, [\"password\"]) expires just the password field after 60 seconds while other fields remain. The API is compatible with the Redis 8.0 API and supported by valkey-glide 2.1.0. daily.dev surfaces practical release notes like this for teams adopting new Valkey TTL features."}},{"@type":"Question","name":"How much memory overhead does per-field TTL tracking add in Valkey 9.0 hashes?","acceptedAnswer":{"@type":"Answer","text":"Per-field expiration overhead in Valkey 9.0 ranges between 16 and 29 bytes per field, depending on how many fields have TTLs and how spread out their expiration times are. The higher end mostly affects small hashes, since compact listpack encoding is avoided once volatile fields are present. Command throughput showed no measurable regression when expirations were added. Engineers evaluating Valkey's memory tradeoffs can track benchmarks like these on daily.dev."}},{"@type":"Question","name":"Why doesn't Valkey use lazy expiration for hash field TTLs the way it does for whole keys?","acceptedAnswer":{"@type":"Answer","text":"Valkey chose not to implement lazy expiration for hash fields because adding expiration checks to every HGET, HSET, or HDEL call would complicate the hot path of hash commands and risk performance regressions. Instead, the active expiration background job was extended to scan a new 'volatile set' structure tracking field-level expiration buckets alongside top-level keys. daily.dev helps engineers weighing expiration and caching design tradeoffs stay current on database internals."}}]}
```

