Skip to content

Opt-out caching for endpoints unlikely to be revisited #5

Description

@Sootopolis

Context

ChessComClient.getCacheable (and therefore get, which is a thin wrapper) unconditionally persists every 200 response to api_response_cache + api_response_body. For endpoints that are fetched once and never revisited, this is pure storage cost with no payoff.

Motivating example

Ancient finished matches from a sequential ID scan would each get a cache row. At ~1.93M match IDs and most of them cold, the cache bloat would be substantial and unrecoverable.

Options

  • Explicit opt-out parameter on the client API — e.g. getCacheable[T](url, cache = false).
  • URL-pattern opt-out list — configured regex/prefixes that skip the cache write.
  • Automatic decision based on Cache-Control: max-age — Chess.com's values are binary 5s / 3600s. Only caching max-age >= 3600 would skip ephemeral payloads; could over-skip for one-shot contexts that also return 3600s.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:clientChess.com HTTP client, cache, rate limitingarea:dbSchema, SQL, migrations, MagnumenhancementNew feature or requestpending-decisionWaiting on a direction to be chosen

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions