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

Add the ability to configure or clear the cache #405

Open
AndreMiras opened this issue Oct 14, 2024 · 0 comments
Open

Add the ability to configure or clear the cache #405

AndreMiras opened this issue Oct 14, 2024 · 0 comments

Comments

@AndreMiras
Copy link

The library uses memoizee to cache function calls in various places, such as in src/router.ts, where TVL and route resolution are cached. While caching makes sense in many scenarios, it would be useful to allow users to either configure or clear the cache based on their needs.

Context: I'm working on an arbitrage bot that leverages the library, and there are times when I need the freshest data. For instance, if I know a transaction has unbalanced a pool, I need to bypass the cache and get the latest data.
Another use case is during my integration tests, where I'm replaying swap transactions from older blocks using Anvil/Hardhat block resets. Since routes are cached for 5 minutes, the same resolution is returned for a given token swap, even though I'm working with completely different blocks between tests. Ideally, I'd like to wipe or ignore the cache in this testing environment.

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

No branches or pull requests

1 participant