import type { Redis, RedisKey, RedisOptions } from "ioredis"

export type RedisPluginOptions = {
  url?: string
  options?: RedisOptions
}

export type RedisService = {
  get(key: string): Promise<string | null>
  set(key: string, value: string, expireSeconds?: number): Promise<"OK">
  del(...keys: [...keys: RedisKey[]]): Promise<number>
  exists(key: string): Promise<number>
  incr(key: string): Promise<number>
  expire(key: string, seconds: number): Promise<number>
  multi(): Redis
  setex(key: string, seconds: number, value: string): Promise<"OK">
  mget(...keys: string[]): Promise<(string | null)[]>
  keys(pattern: string): Promise<string[]>
  ttl(key: string): Promise<number>
}
