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

BetterKV still hits a lot of KV.get #6

Open
lavrton opened this issue Sep 20, 2024 · 1 comment · May be fixed by #7
Open

BetterKV still hits a lot of KV.get #6

lavrton opened this issue Sep 20, 2024 · 1 comment · May be fixed by #7

Comments

@lavrton
Copy link

lavrton commented Sep 20, 2024

Hello. I have several questions, all of them around one issue. So I am using BetterKV and I noticed that I don't see much reduction in KV read usage.

Question about line:

Date.now() - created - this.config.cacheTtl,

Isn't there an issue in ms vs secs metrics? cacheTtl is in secs, right? Looks like it will make Math.random() < probability always true, which will lead to reading from cache.

Here shouldn't we try to use expirationTtl from options when we set a key/value?

"cloudflare-cdn-cache-control": `max-age=${this.config.cacheTtl}`,

@helloimalastair helloimalastair linked a pull request Oct 16, 2024 that will close this issue
@helloimalastair
Copy link
Owner

@lavrton how is this for your first issue?

As for the second thing, while it would be more efficient, I don't think it actually hurts anything to cache longer, since we check for expiration with the probability check anyway?

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 a pull request may close this issue.

2 participants