-
Notifications
You must be signed in to change notification settings - Fork 45
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
Implemented a simple SQL based TTL cache #140
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #140 +/- ##
==========================================
+ Coverage 94.38% 94.71% +0.33%
==========================================
Files 26 27 +1
Lines 2566 2727 +161
Branches 330 350 +20
==========================================
+ Hits 2422 2583 +161
Misses 143 143
Partials 1 1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! Just a small question about the additional cleanup call on get.
src/web5-connect/sql-ttl-cache.ts
Outdated
*/ | ||
public async get(key: string): Promise<object | undefined> { | ||
// clean up expired entries but no need to await for it to finish | ||
this.cleanUpExpiredEntries(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sanity: What is the purpose of calling this here since it's running on an interval + the particular record's expiry is checked/deleted below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, keeping it simple. Removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎸 🚀
- Implemented a simple SQL based TTL cache. - Introduced `HttpApi.create()` to support async object creation pattern. - Fixed bug in PostgreSQL dialect instantiation. - 100% new code coverage.
HttpApi.create()
to support async object creation pattern.