1.0.1 • Published 8 months ago

@blued-core-oversea/ioredis-client v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
8 months ago

基于 ioredis 的一层封装。

npm i @blued-core-oversea/ioredis-client

redis client:

export const redis: Record<string, string | RedisClientConf> = {
  test: 'xxxxxxxxxxxxx',
}

// or
export const redis: Record<string, string | RedisClientConf> = {
  test: {
    host: 'xxxxxxxxxxxxx',
    maxConnAge: 5 * 1000,
    poolSize: 3,
    verify: {        // 用户名密码【非必须项】
      userNameConf: 'xxxxxxxxxxx',
      passwordConf: 'xxxxxxxxxxx',
    }
  },
  test2: 'xxxxxxxxxxxxxx',
}


const redisClient = new RedisClient(redis, {
  commandTimeout: 100,
  maxRetry: 2000,
  enableReadyCheck: false,
})

const testRedisClient = () => redisClient.getClient('test')

async function main () {
  const test = await awsRedisClient().pipeline().type('test').type('aaaaaaaa')
      .exec()
  console.log(test)
}

main()

cluster redis client:

export const redis = {
  test: 'xxxxxxxxxxxxx',
}

const redisClient = new ClusterRedisClient(redis, {
  isPingCheck: true,
  refreshDuration: 2,
})

const testRedisClient = () => redisClient.getClient('test')

async function main () {
  await testRedisClient().get('a')
}

main()
1.0.1

8 months ago

1.0.0

11 months ago

0.2.0

3 years ago

0.1.0

3 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago