Toshihiko
    正在准备搜索索引...

    基于 Redis 的 Cache 实现,使用 ioredis pipeline 批量读取和失效缓存。

    层级 (查看层级一览)

    索引
    • 创建 Redis Cache。

      参数

      • servers: string

        以下格式的 Redis 地址:host:port 形式。

      • 可选options: RedisCacheOptions

        ioredis 选项和可选 Cache key 前缀。

      • 可选client: Redis<"legacy">

        现有 ioredis 客户端,主要用于集成和测试。

      返回 RedisCache

    prefix: string

    添加到生成的 Redis key 前的前缀。

    redis: Redis

    底层 ioredis 客户端。

    • 删除一行缓存数据。

      参数

      • database: string
      • table: string
      • key: CacheKey

      返回 Promise<number>

    • 删除多个 key 对应的缓存数据行。

      参数

      • database: string
      • table: string
      • keys: readonly CacheKey[]

      返回 Promise<number[]>

    • 按请求顺序读取缓存数据行,并使用 null 表示缓存未命中。

      类型参数

      • Value extends object

      参数

      返回 Promise<(Value | null)[]>

    • 在 Cache key 下存储一行序列化数据。

      类型参数

      • Value extends object

      参数

      返回 Promise<"OK" | null>