0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Idempotency key vs Content cache key

Posted at

difference

Idempotency key

don’t do the side-effect twice

  • scope: a specific operation
  • storage: usually a UNIQUE constraint or a short-lived “seen” table
  • stable even if implementation details change

Content cache key

  • don’t recompute if inputs didn’t change
  • scope: a specific computation, like summarizing things
  • derived from inputs (e.g., hash(content + prompt_version + model))
  • changes whenever inputs change

can a content cache key also be an idempotency key?

unlikely
only if the operation’s effect is entirely determined by those inputs and the scope matches the business rule

can an idempotency key double as a cache key?

also unlikely
idempotency key prevents duplicate effects, not redundant computation.

takeaway

Algorithm drift:

  • change your summarization prompt/model → cache key changes (good)
  • but idempotency keys should not change because you refactored code
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?