Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standardize Memory Cache API: Align delete operation with KV API #3553

Draft
wants to merge 2 commits into
base: mar/memory-cache-delete
Choose a base branch
from

Conversation

mar-cf
Copy link
Collaborator

@mar-cf mar-cf commented Feb 14, 2025

No description provided.

@mar-cf mar-cf changed the base branch from main to mar/memory-cache-delete February 14, 2025 16:27
@mar-cf mar-cf requested a review from mikea February 14, 2025 16:35
@danlapid
Copy link
Collaborator

@rts-rob did mention that while aligning on api in terms of method names/signature is good we shouldn't align on async vs sync.
If we are able to make the operation sync instead of async we should.
He commented that on Jan 7th in the internal ticket.

@kentonv
Copy link
Member

kentonv commented Feb 14, 2025

In the past we've discussed wanting this interface to be able to be backed by a colo-wide cache without having to change the calling code, in which case delete() would need to be async.

But per the other thread I'm unsure if we should be adding this method at all.

@rts-rob
Copy link

rts-rob commented Feb 14, 2025

For clarity, we don't prefer or require sync over async, I was just trying to point out that we don't require it to be async to be match KV's API. Either implementation is fine for KV.

@jasnell
Copy link
Member

jasnell commented Feb 14, 2025

+1 to having this return a promise if we add it at all. Doing so is going to give us the most flexibility with the implementation long term.

}

auto deleteSpan = IoContext::current().makeTraceSpan("memory_cache_delete"_kjc);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not very familiar with volatile cache/memory cache, but except for acquiring the lock in SharedMemoryCache::Use::delete_() this looks like a mostly synchronous operation here right? Not sure if we should add a span here since we'd expect the operation to complete very quickly; we'd also need to add some internal plumbing to support/document the span.

Copy link

The generated output of @cloudflare/workers-types has been changed by this PR. If this is intentional, run bazel build //types && rm -rf types/generated-snapshot && cp -r bazel-bin/types/definitions types/generated-snapshot to update the snapshot. Alternatively, you can download the full generated types:

Full Type Diff

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.

6 participants