Skip to content

Add the ability to configure or clear the cache #405

Open
@AndreMiras

Description

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions