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

Preferences caching #2792

Closed

Conversation

dholms
Copy link
Collaborator

@dholms dholms commented Sep 5, 2024

No description provided.

repoRevCacheMaxTTL: envInt('PDS_REPO_REV_CACHE_MAX_TTL'), // milliseconds (use 0 to disable)
preferencesCacheMaxTTL: envInt('PDS_REPO_REV_CACHE_MAX_TTL'), // milliseconds (use 0 to disable)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
preferencesCacheMaxTTL: envInt('PDS_REPO_REV_CACHE_MAX_TTL'), // milliseconds (use 0 to disable)
preferencesCacheMaxTTL: envInt('PDS_PREFS_CACHE_MAX_TTL'), // milliseconds (use 0 to disable)

Comment on lines +11 to +18
const cachedPrefs = await ctx.preferencesCache?.get(requester)
if (cachedPrefs) {
const preferences = JSON.parse(cachedPrefs)
return {
encoding: 'application/json',
body: { preferences },
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

We still want to apply the scope here.

Comment on lines +30 to +33
await ctx.preferencesCache?.set(
requester,
JSON.stringify(checkedPreferences),
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe this could cache different contents depending on the user's scope. Maybe it would be more straightforward to control the cache contents entirely on the read path as a read-through cache, and turn this into an invalidation.

@matthieusieben matthieusieben deleted the branch msieben/read-after-write-caching November 4, 2024 14:51
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.

3 participants