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

Did caching #856

Merged
merged 17 commits into from
Apr 25, 2023
Merged

Did caching #856

merged 17 commits into from
Apr 25, 2023

Conversation

dholms
Copy link
Collaborator

@dholms dholms commented Apr 21, 2023

Split off from simple-service-auth for ease of review

This adds a Postgres DID cache to the appview building off of #842

We do stale-while-revalidate when TTL is passed & can override the cache for sensitive operations such as updating indexed handles

.executeTakeFirst()
if (!res) return null
const now = Date.now()
const updatedAt = new Date(res.updatedAt).getTime()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Date may not have to come into play here since res.updatedAt is a unix timestamp itself.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

oh yeah i had that as Date originally 🙃


export interface DidCache {
did: string
doc: DidDocument
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it all good for tombstoned dids to be cached here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I cleaned it up a bit so if we try to refresh & it's missing, we'll clear out the cache. should fix tombstoned dids 👍

Copy link
Collaborator

@devinivy devinivy left a comment

Choose a reason for hiding this comment

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

Excellent 👍!!

@dholms dholms merged commit a2f9c86 into simple-service-auth Apr 25, 2023
@dholms dholms deleted the did-caching branch April 25, 2023 19:21
@bnewbold bnewbold mentioned this pull request May 24, 2023
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