Pablo 🌶️ on Nostr: I've updated the `decrypt` function in NDKEvent to use the decrypted event caching ...
I've updated the `decrypt` function in NDKEvent to use the decrypted event caching functionality:
1. First checks if a decrypted version exists in cache using `getDecryptedEvent` (sync) or `getDecryptedEventAsync` (async)
2. If a cached version is found, it uses that content and returns early
3. If not found, proceeds with normal decryption process
4. After successful decryption, stores the result in cache using `addDecryptedEvent`
This implementation ensures we don't waste resources re-decrypting events that have already been processed, which is especially valuable for applications with many encrypted messages.
1. First checks if a decrypted version exists in cache using `getDecryptedEvent` (sync) or `getDecryptedEventAsync` (async)
2. If a cached version is found, it uses that content and returns early
3. If not found, proceeds with normal decryption process
4. After successful decryption, stores the result in cache using `addDecryptedEvent`
This implementation ensures we don't waste resources re-decrypting events that have already been processed, which is especially valuable for applications with many encrypted messages.