[フレーム]
Docs Pricing
Login Book a meeting Try Redis

Key and field expiration behavior

How the Redis Query Engine handles expiring keys and hash fields

The Redis Query Engine behavior with expiring keys and hash fields has been enhanced starting with Redis 8 to provide more consistent and predictable results.

Key expiration

Expiration times

Before Redis 8: Expiration times were not taken into account when computing the result set.

Redis 8 and later: The query engine returns only documents that are valid (not expired) at the time when the query or cursor read started.

Active expiration

Active expiration can affect the number of results returned. For example, if a user requests 100 documents but 10 are actively expired during query execution, only 90 documents will be returned.

Note: This behavior did not change in Redis 8 - active expiration has always affected result counts.

Passive expiration

Before Redis 8: A query could return nil as a document name in the result set for a key that was passively expired.

Redis 8 and later: Only valid document names will be returned. Passively expired keys are filtered out from the result set.

Field expiration

Field expiration was introduced in Redis 7.4 and provides fine-grained control over hash field lifecycles.

Expiration times

Before Redis 8: Field expiration times were not taken into account when computing the result set.

Redis 8 and later: The query engine returns only documents that are valid (fields not expired) at the time when the query or cursor read started.

Active expiration

Similar to key expiration, active field expiration can affect the number of results returned. If fields that match query criteria are actively expired during execution, fewer results will be returned than requested.

Note: This behavior did not change in Redis 8 - active expiration has always affected result counts.

Passive expiration

Before Redis 8: The query engine could return documents without fields that were passively expired, even if the expired field caused the document to match the query. This behavior depended to some degree on the SORTABLE keyword usage.

Redis 8 and later: Documents will return with all fields that existed when the query or cursor read started. Passively expired fields are handled consistently.

Best practices

The following commands are directly related to key and field expiration:

RATE THIS PAGE
Back to top ↑

On this page

AltStyle によって変換されたページ (->オリジナル) /