首页 > 解决方案 > Redis 命令选项的完整列表

问题描述

我查看了许多库,但找不到 Redis 命令选项('redis'、'redis-commands'、'ioredis'、'@nestjs/microservices')的任何常量。以及 TypeScript 项目的许多其他接口。我错过了什么?我已经开始慢慢地为“ioredis”构建定义文件。

/**
 * @link https://redis.io/commands/set
 */
export enum SET_OPTIONS {
  /**
   * seconds -- Set the specified expire time, in seconds.
   */
  EX = 'EX',
  /**
   * timestamp-seconds -- Set the specified Unix time at which the key will expire, in seconds.
   */
  EXAT = 'EXAT',
  /**
   * Return the old string stored at key, or nil if key did not exist.
   * An error is returned and SET aborted if the value stored at key is not a string.
   */
  GET = 'GET',
  /**
   * Retain the time to live associated with the key.
   */
  KEEPTTL = 'KEEPTTL',
  /**
   * Only set the key if it does not already exist.
   */
  NX = 'NX',
  /**
   * milliseconds -- Set the specified expire time, in milliseconds.
   */
  PX = 'PX',
  /**
   * timestamp-milliseconds -- Set the specified Unix time at which the key will expire, in milliseconds.
   */
  PXAT = 'PXAT',
  /**
   * Only set the key if it already exist.
   */
  XX = 'XX',
}

/**
 * @link https://redis.io/commands/expire
 */
export enum EXPIRE_OPTIONS {
  /**
   * Set expiry only when the new expiry is greater than current one
   */
  GT = 'GT',
  /**
   * Set expiry only when the new expiry is less than current one
   */
  LT = 'LT',
  /**
   * Set expiry only when the key has no expiry
   */
  NX = 'NX',
  /**
   * Set expiry only when the key has an existing expiry
   */
  XX = 'XX',
}

标签: typescriptredistypescript-typings

解决方案


推荐阅读