0.2.0 • Published 1 year ago

@blued-core-oversea/ioredis-client v0.2.0

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year 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()
0.2.0

1 year ago

0.1.0

2 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago