Unverified Commit f32d12a0 authored by Hong Minhee's avatar Hong Minhee
Browse files

Some example code

[ci skip]
parent 7a465c05
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -13,6 +13,17 @@ implementations for Redis:
 -  [`RedisKvStore`]
 -  [`RedisMessageQueue`]

~~~~ typescript
import { createFederation } from "@fedify/fedify";
import { RedisKvStore, RedisMessageQueue } from "@fedify/redis";
import { Redis } from "ioredis";

const federation = createFederation({
  kv: new RedisKvStore(new Redis()),
  queue: new RedisMessageQueue(() => new Redis()),
});
~~~~

[JSR]: https://jsr.io/@fedify/redis
[JSR badge]: https://jsr.io/badges/@fedify/redis
[npm]: https://www.npmjs.com/package/@fedify/redis
@@ -55,6 +66,8 @@ Changelog

To be released.

 -  Added some example code.

### Version 0.1.1

Released on June 22, 2024.
+12 −0
Original line number Diff line number Diff line
@@ -22,6 +22,18 @@ export interface RedisKvStoreOptions {

/**
 * A key-value store that uses Redis as the underlying storage.
 *
 * @example
 * ```ts
 * import { createFederation } from "@fedify/fedify";
 * import { RedisKvStore } from "@fedify/redis";
 * import { Redis } from "ioredis";
 *
 * const federation = createFederation({
 *   // ...
 *   kv: new RedisKvStore(new Redis()),
 * });
 * ```
 */
export class RedisKvStore implements KvStore {
  #redis: Redis;
+12 −0
Original line number Diff line number Diff line
@@ -51,6 +51,18 @@ export interface RedisMessageQueueOptions {

/**
 * A message queue that uses Redis as the underlying storage.
 *
 * @example
 * ```ts
 * import { createFederation } from "@fedify/fedify";
 * import { RedisMessageQueue } from "@fedify/redis";
 * import { Redis } from "ioredis";
 *
 * const federation = createFederation({
 *   // ...
 *   queue: new RedisMessageQueue(() => new Redis()),
 * });
 * ```
 */
export class RedisMessageQueue implements MessageQueue, Disposable {
  #redis: Redis;