Cache
genshin-kit.js has cached most of responses from the API(except some routes you can check API Reference), so you can use cache instead making a new request.
Note: In most of the cases, the key of cache is the UID
.
//...
<ROUTER>.cache.get("key");
Custom Sweeper
You can customize it by passing cacheOptions
to the constructor of router.
//...
cacheOptions: {
maxAge: 60, // the cache will be deleted after 60 seconds
maxSize: 0, // it wouldn't cache anythings
},
//...