-
Notifications
You must be signed in to change notification settings - Fork 7
Add contract ID cache and DB table #192
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
base: main
Are you sure you want to change the base?
Conversation
I'm not convinced the benefits we're getting by caching name and symbol is worth adding an additional component to the architecture. We want this project to be as easy to run for other organizations as possible. If we want this indexed, can we store it in postgres? |
@JakeUrban @marcelosalloum My bad, in my mind I was thinking of how freighter backend would use this and since it already uses redis this was very straightforward. However, I agree with making it easy for the ecosystem to use. We can just store it in-memory instead. I will update the code to use it |
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.
Looking great!
I left a few comments about code completeness and a question regarding database expiration. We can sync by DM if you want.
What
contracts
DB table which stores thename
andsymbol
of custom tokens.This mapping is stored as a hash map structure in memory. We use the go-cache library for setting up the cache.
For pod restarts, the cache will be initialized from the DB which acts a persistent data store.
Why
We dont need to call the simulation function each time to get the relevant name and symbol values for custom tokens. We can simply store the information in the cache when processing token transfer events for these tokens and use the info by querying against the cache.
Known limitations
N/A
Issue that this PR addresses
Closes #190 #206 #207
Checklist
PR Structure
all
if the changes are broad or impact many packages.Thoroughness
Release