Skip to content

Add expiration/deletion to Valkey cache#3024

Merged
gbrodman merged 1 commit intogoogle:masterfrom
gbrodman:valkeyExpiration
Apr 30, 2026
Merged

Add expiration/deletion to Valkey cache#3024
gbrodman merged 1 commit intogoogle:masterfrom
gbrodman:valkeyExpiration

Conversation

@gbrodman
Copy link
Copy Markdown
Collaborator

@gbrodman gbrodman commented Apr 24, 2026

This will be necessary for the batch job that runs however often to "catch up" to the existing state.

Also we also only store "real" domains in Valkey.


This change is Reviewable

@gbrodman gbrodman requested review from CydeWeys and ptkach April 27, 2026 14:22
Copy link
Copy Markdown
Collaborator

@ptkach ptkach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ptkach reviewed 5 files and all commit messages, and made 3 comments.
Reviewable status: 5 of 6 files reviewed, 2 unresolved discussions (waiting on CydeWeys and gbrodman).


core/src/main/java/google/registry/cache/MultilayerDomainCache.java line 61 at r1 (raw file):

  @Override
  protected String getJedisPrefix() {
    return "Domain__";

I'd missed the review on this and it's not major, but did we consider a smaller prefix for domains, like "d_" for instance? I mean these 8 bytes will add up


core/src/main/java/google/registry/cache/SimplifiedJedisClient.java line 75 at r1 (raw file):

        resource.key.getBytes(StandardCharsets.UTF_8),
        serialize(resource.value),
        new SetParams().pxAt(resource.value.getDeletionTime().toEpochMilli()));

What's your plan on deletion? I'm concerned with majority of domains being set as deleted at the end of time these will never get expired on its own .


core/src/main/java/google/registry/cache/SimplifiedJedisClient.java line 111 at r1 (raw file):

              .map(key -> key.getBytes(StandardCharsets.UTF_8))
              .toArray(byte[][]::new);
      jedis.unlink(keysToUnlink);

unlink - good choice!

Copy link
Copy Markdown
Collaborator Author

@gbrodman gbrodman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gbrodman made 2 comments.
Reviewable status: 5 of 6 files reviewed, 2 unresolved discussions (waiting on CydeWeys and ptkach).


core/src/main/java/google/registry/cache/MultilayerDomainCache.java line 61 at r1 (raw file):

Previously, ptkach (Pavlo Tkach) wrote…

I'd missed the review on this and it's not major, but did we consider a smaller prefix for domains, like "d_" for instance? I mean these 8 bytes will add up

I wasn't sure what other types of data we'd be storing so I was being overly cautious. Messaging you offline to chat about this


core/src/main/java/google/registry/cache/SimplifiedJedisClient.java line 75 at r1 (raw file):

Previously, ptkach (Pavlo Tkach) wrote…

What's your plan on deletion? I'm concerned with majority of domains being set as deleted at the end of time these will never get expired on its own .

Yep, that's the thinking. The batch job to sync up the cache will update the deletion time when the domain does eventually get deleted

Copy link
Copy Markdown
Collaborator Author

@gbrodman gbrodman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gbrodman made 1 comment.
Reviewable status: 5 of 6 files reviewed, 2 unresolved discussions (waiting on CydeWeys and ptkach).


core/src/main/java/google/registry/cache/MultilayerDomainCache.java line 61 at r1 (raw file):

Previously, gbrodman wrote…

I wasn't sure what other types of data we'd be storing so I was being overly cautious. Messaging you offline to chat about this

From offline discussion: moving to e.g. d_ in order to save a bit of space

Copy link
Copy Markdown
Collaborator

@ptkach ptkach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ptkach reviewed 6 files and all commit messages, and resolved 2 discussions.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on CydeWeys).

@gbrodman gbrodman added this pull request to the merge queue Apr 30, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 30, 2026
This will be necessary for the batch job that runs however often to
"catch up" to the existing state.

We also only store "real" domains in Valkey.
@gbrodman gbrodman enabled auto-merge April 30, 2026 19:11
@gbrodman gbrodman added this pull request to the merge queue Apr 30, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 30, 2026
@gbrodman gbrodman added this pull request to the merge queue Apr 30, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 30, 2026
@gbrodman gbrodman added this pull request to the merge queue Apr 30, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 30, 2026
@gbrodman gbrodman added this pull request to the merge queue Apr 30, 2026
Merged via the queue into google:master with commit f44642f Apr 30, 2026
9 checks passed
@gbrodman gbrodman deleted the valkeyExpiration branch April 30, 2026 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants