Redis Client-Side Caching: Targeted Reduction of Network Traffic and Latency

Redis client-side caching stores suitable read results directly in the application process. A local match Avoids the Redis read operation and its network traffic. Redis Tracking notifies the client of changes so that it can remove affected entries. Data that is read very frequently but rarely changed is particularly suitable for this. Whether the application becomes faster overall depends, among other things, on the hit rate, write load, and memory requirements. Furthermore, invalidations do not guarantee that concurrent accesses will always see a globally up-to-date value.

Local Hits and Redis Accesses

A product catalog reads item information from Redis every time it is accessed. The first time a valid key is accessed, the result is not yet in the local cache: The application queries Redis and can store the response in its process’s memory. This first access is a Cache Miss.

If the same process requests the value again and the entry is still valid, the response comes from local storage. This match avoids the Redis read operation and the associated network traffic. Especially for frequently read, rarely updated product data, this can reduce the number of requests to Redis and save time.

If another service modifies the item in Redis, Redis can notify the client of the affected key name. The client removes the local entry; the next time it reads the item, a miss occurs again, and the value is reloaded from Redis. The invalidation itself is not an updated product response.

The Process memory It is not the same as the central Redis store. Multiple application instances can each have their own local entries and must keep their caches up to date independently. If a request is routed to another instance, it may initially trigger a miss there, even though the value is already stored locally elsewhere.

A local hit does not automatically make the entire service faster: the hit rate, write load, network path, and memory usage also influence the result. Redis itself can also serve as a central cache layer, for example when Caching for WordPress with Redis. Client-side caching extends this layer by adding storage directly within the application.

Tracking and the Limits of Timeliness

To prevent local entries from becoming permanently outdated without being noticed, Redis uses server-side Tracking. In normal mode, the server keeps track of which keys a connection has requested via read operations. This process is not limited to simple GET requests: other read-only commands can also affect tracked keys.

If a tracked key is modified, expires, or is evicted by Redis due to a storage policy, the server sends an invalidation. The client must then remove the affected local results. Only a subsequent read operation will load an up-to-date value, if applicable; the notification does not automatically include this value.

AI-generated illustration of a tile removed from its local storage compartment, symbolizing invalidation
AI-generated illustration: An invalidation removes the local entry instead of automatically providing a new value.

This process does not provide a blanket guarantee that responses will always be globally up-to-date. Between the time a change occurs, the message is delivered, and it is processed, concurrent access may occur. For profiles or other data with strict timeliness requirements, you should therefore verify the level of consistency actually provided by the specific client implementation and the overall architecture.

Redis limits the overhead of its tracking table. If a tracked entry needs to be removed from it, the server may invalidate it as a precaution, even though the stored value has not changed. This ensures the correctness of the process but may result in an additional miss and a repeat read operation.

Even keys with the same name in different logical databases can cause unexpected invalidations: The tracking table does not distinguish between key names based on the database. A change in one database can therefore invalidate a local entry with the same name in another database, even though its value has not been changed.

Products, Protocols, and Client Versions

Before implementation, you must consider the server product, database version, protocol, and client library separately. Redis Open Source supports server-side tracking starting with version 6. Redis Software and Redis Cloud have their own compatibility limitations; in particular, the redirection of invalidations via REDIRECT Not available.

Product and Protocol Limits for Server-Side Tracking
ProductMinimum versionProtocolREDIRECT
Redis Open SourceRedis 6RESP2 or RESP3Supported
Redis Software and Redis CloudRedis database version 7.4RESP3Not supported

The server function alone does not yet provide a finished local cache. The library must store results, handle invalidations, and manage the cache appropriately in the event of connection issues. Therefore, check which features and configuration options are available for the client version actually in use.

The Redis introduction lists the following minimum versions for client-side caching: redis-py 5.1.0, Jedis 5.2.0, node-redis 5.1.0, and go-redis 9.22.0. These version numbers do not mean that all libraries support the same operating modes or the same selection of individual keys. The documentation for the selected version is authoritative.

According to the connection-specific documentation for go-redis, the function is experimental. That document lists RESP3, standalone clients, and logical database 0 as prerequisites or limitations. Therefore, an existing Redis server with tracking support is not sufficient to determine its suitability for every go-redis setup.

Understanding Invalidation in the Test

Using two connections, you can observe how Redis notifies you of a change to a key that was previously read. To do this, use an isolated test environment and a key created specifically for this purpose: The write command modifies data. This example is schematic and illustrates the protocol principle; it is not a complete client implementation.

First, specify the Redis client, its version, and the RESP mode. For this process, Connection A must support RESP3 and the processing of push messages; check the documentation for the selected client to see how it makes these messages visible. A normal command response alone does not indicate whether the invalidation was received and processed.

Execute the following commands in the order shown. The labels A and B refer to two separate connections and are not part of the respective command. The first line enables tracking on A; B writes only after A has read the key.

Code
Verbindung A: CLIENT TRACKING ON
Verbindung A: GET beispiel:profil
Verbindung B: SET beispiel:profil neuer-wert

After the read operation, Redis tracks the key for connection A. If B changes the value, Redis sends a Invalidation To A. Its display depends on the client; it does not automatically include the new value. A true cache would have to remove the affected local entry and read it again if necessary.

This example does not store any read results locally and does not handle connection failures or concurrent access. It is therefore intended to help you understand the sequence of messages, not as a template for a production-ready cache. Test for such error cases using the library you are actually using and its connection configuration.

Select Tracking Modes as Needed

Redis offers various ways to define the scope of data being tracked. This choice affects how much state the server manages and how many invalidation requests are sent to the client. It is a protocol decision: You must determine separately whether and how a library makes the respective options available to its local cache.

Tracking Methods and Their Effects
VariantServer costsNews Consumption BehaviorScope of Application
NormalManages tracked keys and associated clients.Invalidates tracked keys when relevant changes are made.Should read operations on keys be tracked by default?
OPTINTracks only explicitly selected read operations.Invalidations apply to the selected keys.Is it possible to specifically mark appropriate read operations?
BroadcastingThere is no tracking table for each key read in this mode.Invalidated based on subscribed prefixes, even for keys that are not stored locally.Do the prefixes sufficiently narrow down the data of interest?

In normal mode, Redis can also track keys whose results the application does not store locally at all. OPTIN limits tracking to selected read operations. When OPTIN is enabled, it marks CLIENT CACHING YES Generally, the command that immediately follows; documented special rules apply to transactions and scripts.

At Broadcasting Instead, you subscribe to key prefixes. In this mode, Redis does not need to keep every key it reads in a tracking table. However, a change can trigger notifications to clients that have never cached the key in question.

A broad prefix includes more keys and can generate a correspondingly higher number of messages when many changes are made. Narrower prefixes are only helpful if they match the actual access pattern and cover all the necessary keys. Therefore, do not compare only the server overhead, but also the message volume and the overhead for client processing.

What data benefits from caching?

A product catalog with frequently accessed and rarely modified entries is an obvious candidate. Repeated accesses can be handled locally, while changes invalidate the affected entries. However, how often the same process needs to retrieve an entry again also depends on how requests are distributed across the application instances.

Repeated read operations are also of interest when it comes to user profiles. However, the key factor is the Timeliness Requirement: If another service modifies a profile, concurrent requests may still see an older value before the update is processed. The product team must decide whether a briefly outdated display is acceptable for the specific use case.

Counters and rankings, on the other hand, change frequently. Frequent invalidations and subsequent read operations can negate the benefits of local hits. For such data, a separate connection without client-side caching may be useful, while another connection continues to cache appropriate, more stable values.

Many keys that are rarely accessed again are also problematic: they take up local memory without yielding frequent hits. A limited cache size protects the memory budget, but does not resolve the question of which data is actually worth storing. Selective tracking or direct Redis accesses may be the better choice for such access patterns.

As an alternative, reduce pipelining the overhead of network round trips by bundling multiple commands. The commands still reach Redis; however, a local cache hit avoids the corresponding read operation. Both methods solve different problems and can also be combined depending on the access pattern.

A conventional local cache with a limited lifetime is another option. However, without reliable invalidation, the application must accept that a modified value may remain out of date until the local TTL expires. Direct accesses bypass this local state and serve as a particularly good benchmark when hits are rare or consistency requirements are high.

Connection Loss and Race Conditions

With RESP3, Redis can send read responses and invalidations to the client over the same connection. Redis Open Source alternatively supports redirecting invalidations to a second connection; with RESP2, this two-connection model is required. Redis Software and Redis Cloud support RESP3 for client-side caching, but do not support redirection via REDIRECT.

Two connections require special care when News Order: One application reads a key while another client is modifying it. The invalidation may arrive via the second connection before the older read response from the first connection has been processed. If the client were to store this response afterward without checking it, a value that is already invalid could remain in the cache.

The Redis documentation describes a placeholder approach: The client marks the pending read operation in the cache in advance. When an invalidation occurs, it removes this placeholder; the response that arrives later must not simply be stored as a valid entry. For a single connection, the order of the messages is known, which simplifies this mapping.

If the connection for invalidations is lost, the client may miss changes. Therefore, treat the local cache as untrusted and clear it before using it again as usual. Reconnecting alone does not retroactively update previously stored values; any required data must be reloaded afterward.

For the selected library and version, check how it handles connection breaks, reconnections, and connection pools. The Redis introduction also describes how its clients clear the cache when a connection is lost within a pool. Whether and when this occurs in your specific implementation is one of the conditions for secure operation.

Limit the Cache and Measure the Impact

Place a Memory Limit for the local cache. It's not just a process's memory usage that matters: If the application is running in multiple instances, each instance may have its own cache. Therefore, plan the budget per instance and keep in mind that the same frequently used values may be stored multiple times in memory.

AI-generated stock image of several memory modules on an antistatic mat
AI-generated illustrative image: Local caches require their own memory for each application instance.

A local maximum TTL can also limit how long an entry is used without being reloaded. It should not be confused with the key's expiration time on the Redis server and does not replace proper invalidation. If a value is changed shortly after being stored locally and the notification is missed, it may otherwise remain out of date until the local expiration time.

For a meaningful comparison, load the same application once with client-side caching and once without it. Use a representative load and keep the environment and configuration as consistent as possible. In particular, document the warm-up phase, the distribution of keys, the proportion of write operations, and the number of instances; otherwise, it will be difficult to attribute differences to the cache.

Track local hits and misses, along with invalidations and Redis requests. Track network traffic and memory usage per instance. A high hit rate is helpful, but it doesn't fully explain whether the additional memory and the processing of invalidations make sense for your service overall.

Also, consider the Latency Distribution of the application rather than just an average value. For example, compare how typical and slower requests behave during and after the warm-up phase. While a local hit avoids the Redis read operation, only measurements under an appropriate load will show whether this reduces the response time of the entire service.

Troubleshooting and Decision to Implement

If the hit rate is low, start by asking whether the same keys are ever read repeatedly within a single instance. A wide key distribution, frequent eviction, or many short-lived instances can prevent the cache from warming up sufficiently. At the same time, check whether the available memory is sufficient for the data that actually recurs.

Many Invalidations Note that values are often changed, or the client may receive messages that are of little use to it. Compare the change rate with the number of read operations and check the selected tracking mode. For data that changes frequently, a separate connection without a local cache may be more appropriate.

If the cache grows more than expected, investigate the cache limit and usage across all instances. If you encounter unexpectedly old data, however, first check how invalidations are handled and how the system behaves when a connection is lost or reestablished. A local TTL can limit the duration of an error, but it does not explain its cause.

For profiles and sessions, the Consistency Requirement A product decision of your own: Determine whether a temporarily outdated display or decision is acceptable and which other services modify the same data. The use of Redis as Session Storage for PHP Applications describes a central storage system; however, this does not guarantee that additional local caches are up to date.

Implement caching primarily for data that is read frequently but rarely changed, provided that memory constraints, client behavior, and freshness requirements align. Selective use separates such values from write-intensive data. Avoid using caching if the measured benefit does not justify the effort or if the application cannot accept the potential consistency limitations.

Sources and Current State of Knowledge

Status of the research:

Research and version status: November 16, 2026. Before implementation, verify product, protocol, and client support again using the documentation for the specific version being used.

https://redis.io/docs/latest/develop/clients/client-side-caching/

https://redis.io/docs/latest/develop/reference/client-side-caching/

https://redis.io/docs/latest/operate/rs/references/compatibility/client-side-caching/

https://redis.io/docs/latest/develop/clients/go/connect/

https://redis.io/docs/latest/develop/use/client-side-caching/

https://redis.io/docs/latest/management/optimization/latency/

Current articles