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

Introduce pluggable backend cache for the HTTP layer. #495

Merged
merged 7 commits into from
Dec 17, 2024

Conversation

crodas
Copy link
Contributor

@crodas crodas commented Dec 7, 2024

Description

Fixes #478.

Notes to the reviewers


Suggested CHANGELOG Updates

CHANGED

ADDED

Add support for custom storages for the HTTP cache layer.

REMOVED

FIXED


Checklist

@crodas
Copy link
Contributor Author

crodas commented Dec 7, 2024

Right now, I have implemented two storage systems, Memory and Redis. I think a 3rd option would be useful as well, a mix of both, where Redis is used to synchronize local cache between N nodes, but the caching is always local. I can work on a prototype if this sounds like a good idea. /cc @callebtc @thesimplekid

@crodas crodas force-pushed the cache-with-custom-backend branch 3 times, most recently from e7efec3 to d80a7bb Compare December 9, 2024 19:46
@crodas
Copy link
Contributor Author

crodas commented Dec 9, 2024

I made redis optional now @thesimplekid

Copy link
Collaborator

@thesimplekid thesimplekid left a comment

Choose a reason for hiding this comment

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

I think we just need to add docs for how to run redis or at least note it must be run externally and link to something. Maybe add it to docker compose?

Other then that LGTM

@thesimplekid thesimplekid added this to the v0.6.0 milestone Dec 11, 2024
Copy link
Collaborator

@thesimplekid thesimplekid left a comment

Choose a reason for hiding this comment

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

I added a redis container to the docker-compose and the ability to read the cache config from env vars. But @crodas can you take a look at what is causing the panic I noted.

@crodas crodas requested a review from thesimplekid December 14, 2024 00:14
@crodas crodas force-pushed the cache-with-custom-backend branch from 6a96e9d to 333159a Compare December 14, 2024 12:31
@thesimplekid thesimplekid changed the title Introduce pluggable backend storage for the HTTP layer. Introduce pluggable backend cache for the HTTP layer. Dec 16, 2024
crodas and others added 6 commits December 16, 2024 17:48
Co-authored-by: thesimplekid <tsk@thesimplekid.com>
1. Remove `new` from trait, it made no sense, added a function to modify the
   ttl and tti instead
2. Removed `unwrap` and add logs instead
@crodas crodas force-pushed the cache-with-custom-backend branch from 333159a to a26bb7a Compare December 16, 2024 20:59
@crodas crodas requested a review from thesimplekid December 16, 2024 21:16
Use a more rusty expr instead of match
Copy link
Collaborator

@thesimplekid thesimplekid left a comment

Choose a reason for hiding this comment

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

Thanks, LGTM

ACK 8f3104f

@thesimplekid thesimplekid merged commit dcca57d into cashubtc:main Dec 17, 2024
50 checks passed
vnprc pushed a commit to vnprc/cdk that referenced this pull request Dec 18, 2024
---------

Co-authored-by: thesimplekid <tsk@thesimplekid.com>
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.

Mint: allow caching with external Redis service
2 participants