hibiken / asynq

Simple, reliable, and efficient distributed task queue in Go
MIT License
9.65k stars 696 forks source link

[FEATURE REQUEST] Support custom Redis cache key or prefix #725

Open shuqingzai opened 1 year ago

shuqingzai commented 1 year ago

Is your feature request related to a problem? Please describe.

The asynq queue uses asynq as the RedisKey prefix. If my redis has multiple asynq service tasks, all of them will be merged. I hope that custom key or custom key:asynq can be used as a prefix to distinguish different ones Serve

Describe the solution you'd like

I hope that the configuration can customize the redis key prefix

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

shuqingzai commented 1 year ago

Is it possible to make asynq in the following func into config options, allowing users to customize, the default is: asynq

https://github.com/hibiken/asynq/blob/6b98c0bbaefbf37907fe4e0404e0408c6ad8a984/internal/base/base.go#L107

https://github.com/hibiken/asynq/blob/6b98c0bbaefbf37907fe4e0404e0408c6ad8a984/internal/base/base.go#L181

https://github.com/hibiken/asynq/blob/6b98c0bbaefbf37907fe4e0404e0408c6ad8a984/internal/base/base.go#L186

https://github.com/hibiken/asynq/blob/6b98c0bbaefbf37907fe4e0404e0408c6ad8a984/internal/base/base.go#L191

https://github.com/hibiken/asynq/blob/6b98c0bbaefbf37907fe4e0404e0408c6ad8a984/internal/base/base.go#L196

@hibiken

kamikazechaser commented 1 year ago

my redis has multiple asynq service tasks

You could use different redis db id/number (namespace) and create multiple lightweight go-redis connection pools for each of them.

hypnoglow commented 1 year ago

See: https://github.com/hibiken/asynq/pull/647

We ended up forking because we needed the prefix and Redis Cluster support in the CLI.

sunxunkang commented 10 months ago

我的redis有多个asynq服务任务

您可以使用不同的 redis db id/number(命名空间)并为每个数据库创建多个轻量级 go-redis 连接池。

redis cluster mode can not select db