ENS Web3.js Plugin with Caching- Add LRU Caching to Resolver for ENS Performance
Expected behavior
The Resolver class should efficiently cache resolver contracts for frequently queried ENS names, reducing network requests and improving performance.
Actual behavior
The Resolver class makes a network request for each ENS name query, which is not necessary.
Steps to reproduce the behavior
- Steps to reproduce the behavior
- Query the same ENS name multiple times.
- Observe repeated network requests for each query.
Hi @uchebuego thanks for the feedback! the core team will take a look at it asap
@uchebuego we had team discussion for feature of adding Caching support in ENS resolver, as there are various customisation options possible for cache including refresh time, retaining time, storage options, should it be in memory or browser storage etc and it depends on application and usecase to implement and use these options. Considering all this we concluded that
-
This functionality should be added in form of a web3.js ENS plugin with support of injectable cache feature in that plugin.
-
There should be a cache interface allowing users to implement any custom cache logic and optionally inject in plugin ( with customizable time, storage options in memory or browser storage, .. )
-
For quick usage there should be one simple implementation of cache in plugin available and used by default.
Hey @uchebuego, is this something you'd like to implement as a web3.js Plugin?
Yes, I'd love to. Will you assign the issue to me?
Hey @uchebuego, how's it going on this? You still working on it?
Hi! Yes, I am! https://github.com/uchebuego/web3-plugin-ens-cache
Hi! Yes, I am! https://github.com/uchebuego/web3-plugin-ens-cache
@uchebuego plus publish this on npm and share link with us, Thanks