docs(develop-docs): add redis TTL guidance page - #19160
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
markstory
left a comment
There was a problem hiding this comment.
Looking good. As we get further in the project this will be a great place to add developer docs for how to use the clients and delegator for workload splitting.
Drop the section on Snuba, Relay, Seer and the uptime checker. It described a temporary gap: those services build their own Redis clients today, but consolidating on a shared one is planned, so the section would date quickly.
| Some write commands silently discard the TTL a key already has: | ||
|
|
||
| - `SET` and `GETSET` replace the value and drop the TTL. Pass `KEEPTTL` to `SET` if you mean to keep it. | ||
| - `SETEX` throws away the existing TTL and installs the one you pass. | ||
|
|
||
| Others leave the TTL alone: `SADD`, `ZADD`, `HSET`, `HINCRBY`, and `INCR` modify the value without touching the expiry. | ||
|
|
||
| None of them ever adds a TTL either. A key created through one of these commands has no expiry at all until something calls `EXPIRE` on it. |
There was a problem hiding this comment.
Bug: The documentation incorrectly claims SETEX 'silently' discards a key's TTL. SETEX requires an explicit TTL, so this behavior is not silent.
Severity: LOW
Suggested Fix
Either rephrase the section heading 'Some write commands silently discard the TTL a key already has' to be more accurate, or move the description of SETEX to a separate section. Clarify that SETEX's behavior is explicit, as it requires a TTL parameter, unlike commands that can silently discard a TTL.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: develop-docs/backend/application-domains/redis.mdx#L29-L36
Potential issue: The documentation under the heading 'Some write commands silently
discard the TTL a key already has' incorrectly includes the `SETEX` command. Unlike
other commands that might implicitly remove a TTL, `SETEX` requires a new TTL value as a
mandatory parameter. This behavior is explicit, not silent. This mischaracterization can
mislead developers into thinking `SETEX` has hidden side effects similar to a `SET`
command without the `KEEPTTL` option, when its TTL handling is actually a core, required
part of the command.
DESCRIBE YOUR PR
This adds a Redis page to the develop docs stating the TTL rules for new keys:
set a TTL or register the key as accepted durable data, a sliding
EXPIREisnot a bound, and some commands silently drop an existing TTL. The rules are
advisory for Snuba, Relay, Seer and the uptime checker, which have no shared
client to enforce through.
The page does not link the accepted-durable-keys list yet: that list has no
published home until INFRENG-455
lands, and that ticket includes adding the link here.
INFRENG-508
IS YOUR CHANGE URGENT?
Help us prioritize incoming PRs by letting us know when the change needs to go live.
Select exactly one option. For deadlines, replace
YYYY-MM-DDwith the due date. You can update this information later by editing the PR description.SLA
Thanks in advance for your help!
PRE-MERGE CHECKLIST
Make sure you've checked the following before merging your changes: