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

Implemented a simple SQL based TTL cache #140

Merged
merged 4 commits into from
Jul 1, 2024
Merged

Conversation

thehenrytsai
Copy link
Collaborator

@thehenrytsai thehenrytsai commented Jun 29, 2024

  • 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.

@codecov-commenter
Copy link

codecov-commenter commented Jun 29, 2024

Codecov Report

Attention: Patch coverage is 96.89119% with 6 lines in your changes missing coverage. Please review.

Project coverage is 94.71%. Comparing base (6471773) to head (58cb180).

Files Patch % Lines
src/storage.ts 37.50% 5 Missing ⚠️
src/http-api.ts 94.73% 0 Missing and 1 partial ⚠️
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.
📢 Have feedback on the report? Share it here.

Copy link
Member

@LiranCohen LiranCohen left a 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/web5-connect-server.ts Show resolved Hide resolved
*/
public async get(key: string): Promise<object | undefined> {
// clean up expired entries but no need to await for it to finish
this.cleanUpExpiredEntries();
Copy link
Member

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?

Copy link
Collaborator Author

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.

Copy link
Member

@LiranCohen LiranCohen left a comment

Choose a reason for hiding this comment

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

🎸 🚀

@thehenrytsai thehenrytsai merged commit d93d543 into main Jul 1, 2024
8 checks passed
@thehenrytsai thehenrytsai deleted the henrytsai/sql-ttl-cache branch July 1, 2024 17:27
bnonni pushed a commit to FormFree/dwn-server that referenced this pull request Aug 7, 2024
- 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.
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