UNPKG

@rivetkit/redis

Version:

_Lightweight Libraries for Backends_

29 lines (26 loc) 1.1 kB
import { GenericConnGlobalState } from '@rivetkit/core'; import { ActorDriver, AnyActorInstance } from '@rivetkit/core/driver-helpers'; import Redis from 'ioredis'; import { G as GlobalState, R as RedisDriverConfig } from './types-CaJ2qnDX.js'; import 'zod'; import '@rivetkit/core/client'; import 'hono'; interface DriverContext { redis: Redis; keyPrefix: string; } /** * Redis implementation of the Actor Driver */ declare class RedisActorDriver implements ActorDriver { #private; constructor(globalState: GlobalState, redis: Redis, driverConfig: RedisDriverConfig); loadActor(actorId: string): Promise<AnyActorInstance>; getGenericConnGlobalState(actorId: string): GenericConnGlobalState; getContext(_actorId: string): DriverContext; readPersistedData(actorId: string): Promise<Uint8Array | undefined>; writePersistedData(actorId: string, data: Uint8Array): Promise<void>; setAlarm(actor: AnyActorInstance, timestamp: number): Promise<void>; getDatabase(actorId: string): Promise<unknown | undefined>; } export { type DriverContext, RedisActorDriver };