0.1.41 • Published 5 months ago

@nostr-dev-kit/ndk-cache-nostr v0.1.41

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

ndk-cache-nostr

NDK cache adapter using a nostr relay as the database.

This cache adapter is meant to be run against a local relay. This adapter will generate two NDK instances:

ndk -- This talks exclusively to the local relay, with outbox model disabled. fallbackNdk -- This is used to hydrate the cache and uses the outbox model -- each query the cache receives is placed in a queue in the background so that subsequent requests can be served from the cache. All events from other relays

Usage

Install

npm add @nostr-dev-kit/ndk-cache-nostr

Add as a cache adapter

import NDKCacheAdapterNostr from "@nostr-dev-kit/ndk-cache-nostr";

const cacheAdapter = new NDKCacheAdapterNostr({
    relayUrl: "ws://localhost:5577",
});
const ndk = new NDK({ cacheAdapter });

If running server-side in a NodeJS environment, you should make sure to polyfill WebSocket.

License

MIT

0.1.30

5 months ago

0.1.31

5 months ago

0.1.32

5 months ago

0.1.10

8 months ago

0.1.33

5 months ago

0.1.11

8 months ago

0.1.34

5 months ago

0.1.12

8 months ago

0.1.35

5 months ago

0.1.13

8 months ago

0.1.36

5 months ago

0.1.14

6 months ago

0.1.37

5 months ago

0.1.15

6 months ago

0.1.27

5 months ago

0.1.28

5 months ago

0.1.29

5 months ago

0.1.41

5 months ago

0.1.20

6 months ago

0.1.21

6 months ago

0.1.22

6 months ago

0.1.23

5 months ago

0.1.24

5 months ago

0.1.25

5 months ago

0.1.26

5 months ago

0.1.40

5 months ago

0.1.38

5 months ago

0.1.16

6 months ago

0.1.8

10 months ago

0.1.39

5 months ago

0.1.17

6 months ago

0.1.7

11 months ago

0.1.18

6 months ago

0.1.19

6 months ago

0.1.9

8 months ago

0.1.6

11 months ago

0.1.5

12 months ago

0.1.2

12 months ago

0.1.4

12 months ago

0.1.3

12 months ago

0.1.1

1 year ago

0.1.0

1 year ago