web3.js icon indicating copy to clipboard operation
web3.js copied to clipboard

ENS Web3.js Plugin with Caching- Add LRU Caching to Resolver for ENS Performance

Open uchebuego opened this issue 1 year ago • 7 comments

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

  1. Steps to reproduce the behavior
  2. Query the same ENS name multiple times.
  3. Observe repeated network requests for each query.

uchebuego avatar Jul 27 '24 13:07 uchebuego

Hi @uchebuego thanks for the feedback! the core team will take a look at it asap

SantiagoDevRel avatar Jul 29 '24 12:07 SantiagoDevRel

@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.

jdevcs avatar Sep 03 '24 18:09 jdevcs

Hey @uchebuego, is this something you'd like to implement as a web3.js Plugin?

mconnelly8 avatar Sep 16 '24 20:09 mconnelly8

Yes, I'd love to. Will you assign the issue to me?

uchebuego avatar Sep 17 '24 11:09 uchebuego

Hey @uchebuego, how's it going on this? You still working on it?

mconnelly8 avatar Oct 07 '24 21:10 mconnelly8

Hi! Yes, I am! https://github.com/uchebuego/web3-plugin-ens-cache

uchebuego avatar Nov 09 '24 09:11 uchebuego

Hi! Yes, I am! https://github.com/uchebuego/web3-plugin-ens-cache

@uchebuego plus publish this on npm and share link with us, Thanks

jdevcs avatar Nov 25 '24 14:11 jdevcs