Introduce pluggable backend cache for the HTTP layer. #495
No reviewers
Labels
No labels
DB & Storage
Deployment
Error Handling & Logging
Maintenance
Payment Backend
backport
backport v0.13.x
backport v0.14.x
backport v0.15.x
bindings
blocked
bug
cdk-sql
ci
cli
deps
documentation
duplicate
enhancement
good first issue
help wanted
invalid
keep-open
ldk-node-ui
migrations
mint
mutation-testing
needs rebase
needs review
new nut
nut change
question
ready
rust-version
rustfmt
stacked hold
stale
testing
wallet
weekly-report
wontfix
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
cashubtc/cdk!495
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "cache-with-custom-backend"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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
just final-checkbefore committingRight 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
I made redis optional now @thesimplekid
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
@ -6,6 +6,14 @@ mnemonic = ""# input_fee_ppk = 0Since the default is memory that should be the default in the example
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.
@ -0,0 +1,188 @@//! HTTP cache.This is causing a runtime panic when run with redis.
I added a redis container to the docker compose and the ability to read the redis config from env vars. However I'm getting a runtime panic when using redis
@ -210,7 +211,10 @@ pub struct MintInfo {NIT code style should use where https://github.com/cashubtc/cdk/blob/main/CODE_STYLE.md#generics.
This applies in a few places but ill just comment here. Won't block merging for it
@ -210,7 +211,10 @@ pub struct MintInfo {I think I addressed all the issues in 6a96e9d
@ -0,0 +1,188 @@//! HTTP cache.I removed all instances of unwrap, but I could not reproduce them. Your Redis server seems to be in a bad state. Can you please pull all my latest and try again? Please paste here anything weird with the logs regarding cache
Cheers,
@ -0,0 +1,96 @@use std::time::Duration;It seems redis returns an empty vec if there is no value for a key. This is causeing the deserlization error we've talked about offline. If we just check if the vec is empty here and return None if it is I believe this PR is good to merge.
@ -0,0 +1,96 @@use std::time::Duration;@thesimplekid I forgot the
?, but I thinka26bb7ad4bis more readableThanks, LGTM
ACK
8f3104f489