Skip to content

feat: Add Redis key prefix support for environment namespacing#1061

Open
ryukunt wants to merge 7 commits intohibiken:masterfrom
ryukunt:master
Open

feat: Add Redis key prefix support for environment namespacing#1061
ryukunt wants to merge 7 commits intohibiken:masterfrom
ryukunt:master

Conversation

@ryukunt
Copy link

@ryukunt ryukunt commented Jul 14, 2025

Hi author, thanks for the awesome project!
I’ve been using it and would like to contribute this feature as well.
This allows different environments or services (prod, staging, dev) to use the same Redis instance without key collisions by namespacing all Asynq keys with a custom prefix.
Thank for your review

@ttc0419
Copy link

ttc0419 commented Sep 3, 2025

@hibiken @kamikazechaser Could you take a look at this or #647? We need this for namespace isolation.

@kamikazechaser
Copy link
Collaborator

I think its a good must-have feature. I'll see if it can make it for v0.26.0.

@wanghaowei0107
Copy link

I think its a good must-have feature. I'll see if it can make it for v0.26.0.

Just wondering — do you have an estimated release date for v0.26.0? And would this feature possibly be included in that version?@kamikazechaser

// KeyPrefix is the Redis key prefix for all Asynq operations.
// This allows you to namespace Asynq keys for different environments.
// If empty, the default prefix "asynq" will be used.
// Examples: "asynq-prod", "asynq-dev", "asynq-staging"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also describe what happens if someone creates multiple clients while setting different prefixes for all of them including a potential empty string.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each client instance is designed for a specific use case with its own prefix, so they won't interfere with each other's logic. This actually enhances isolation between different environments or services. If the prefix is an empty string, it defaults to the original "asynq" prefix, maintaining backward compatibility.

@kamikazechaser
Copy link
Collaborator

Overall I think it won't affect most users who ignore this feature. For those who opt into this feature, it should be described in detail on how to correctly use it.

@yyg-max
Copy link

yyg-max commented Dec 16, 2025

Really need it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants