SERVER1 / Search

What are you looking for?

Search services, pages and articles. Results appear after 2 characters.

View all articles
VPS & Cloud

Redis cache or source of truth: define the boundary

Separate reconstructible copies, sessions and authoritative state. Review persistence, eviction, invalidation and safe fallback on a VPS.

SERVER1.GE4 min read
Redis cache or source of truth: define the boundary

Redis is often introduced to make an application faster, but cache does not mean the same rule for every kind of data. A temporary product-description copy, a user session and the only record of an unpaid order have different consequences. Before deciding what belongs in Redis, establish where each value can be recovered and what happens if it disappears.

The key question is whether Redis stores reconstructible copies or acts as an authoritative data source. Both designs can exist, but require different durability, backup and operating decisions. A technology name does not answer the question. Application use and the consequence of loss do.

Assumption one - “Memory makes everything fast and safe”

Speed and preservation are different requirements. The Redis persistence documentation describes disk persistence options including RDB and AOF. Verify the active configuration and recovery process in your environment. A supported feature is not evidence that it is enabled or working correctly.

In an illustrative application, a product name can be reconstructed from the primary database. The only state of an unprocessed order stored in a temporary key is another matter. For each data type, record its authoritative source, acceptable age and behaviour after loss. This reveals the architectural distinction more clearly than calling everything cache.

Assumption two - “Clearing cache is always safe”

Even when every key is reconstructible, clearing them together can send many requests back to the primary database. Visitors may experience delays without any permanent data loss. If sessions, locks or queued work share the instance, the effect is broader still. A cache label does not establish a safe operation.

Do not use a general flush as a substitute for diagnosis. Identify the key owner, expiry and reconstruction rule first. Scope any necessary change precisely and protect active sessions. Production operations need an agreed procedure rather than an optimistic cleanup attempt.

Assumption three - “The application will handle the memory limit”

The Redis eviction documentation explains that behaviour at the memory boundary depends on the selected policy. Match that choice to the data's purpose. Removing a reconstructible copy and losing important state are different risks. Check the actual version and parameters before recommending a policy.

Leave resources for other processes too. Redis is part of the VPS memory budget, not an independent unlimited space. The application, database and operating system may share the same machine. Observe growth across several intervals and measure user latency and errors alongside cache hits.

Assumption four - “A high hit rate means everything is correct”

A cache can return an outdated or incorrectly personalised result very quickly. Key design must include context that changes the response: language, permissions, user or selected currency where relevant. Storing a private page under a shared key is more than a performance mistake.

Describe invalidation as well: what changes in the primary data, who removes the copy and how long old values may remain visible. Keep an explicit authoritative source for prices and payment decisions. A cached representation should not invent financial rules or conceal a discrepancy.

Three isolated exercises

  1. A key is absent: the application uses the correct source and safely reconstructs the response.
  2. A copy is stale: the agreed update rule applies and does not leave an incorrect result.
  3. Redis is unavailable: timeout and fallback are controlled without unsafe retries changing data.

Use artificial users and records. Observe the load transferred to the database during recovery as well; a functionally correct response is not always operationally acceptable. The resulting record should say which guarantees apply to which data and which parts remain unverified.

Continue with when Redis helps an application and database placement choices. Size an unmanaged VPS for the whole system and define cache ownership separately.

SERVER1.GE

Not sure which infrastructure fits this workload?

Tell us what you run, your expected traffic and current setup. We will help you narrow down the right option.

Relevant services
Choose by workload, not by habit.

Use the article context and your actual resource needs to compare the recommended options.