pull down to refresh
related posts
20 sats \ 2 replies \ @k00b 2 May 2023
Have you considered adding a cache? I think this is the largest hurdle to making performant nostr web apps. I suspect I'd end up rolling my own hooks so that I can have more control over caching.
reply
10 sats \ 0 replies \ @sepehr OP 2 May 2023
also nostr-hooks optimizes subscriptions by first checking for available events that match the provided filters, retrieving those events instead of creating a new subscription. If there are no available events that match the provided filters, a new subscription will be created and the new events will be added to the cache.
reply
0 sats \ 0 replies \ @sepehr OP 2 May 2023
yeah. nostr-hooks has a built-in cache mechanism since v1.1. each event will be available until there is an active subscription for it. once there was no active sub, it will be cached for a fixed amount of time (~10 sec) and if it doesn't receive a new subscription in that time, it will be removed permanently.
reply
20 sats \ 1 reply \ @PlebeiusG 2 May 2023
Is there an example app that uses this?
reply
9 sats \ 0 replies \ @sepehr OP 2 May 2023
yeap! https://nostribe.com is using nostr-hooks.
https://github.com/sepehr-safari/nostribe-web-client
reply