Add TaskKey helper

This commit is contained in:
Ken Hibino
2021-02-21 05:43:50 -08:00
parent fae6c4bdc8
commit 0b043318ba
2 changed files with 25 additions and 0 deletions

View File

@@ -45,6 +45,11 @@ func ValidateQueueName(qname string) error {
return nil
}
// TaskKey returns a redis key for the given task message.
func TaskKey(qname string, id uuid.UUID) string {
return fmt.Sprintf("asynq:{%s}:t:%s", qname, id)
}
// PendingKey returns a redis key for the given queue name.
func PendingKey(qname string) string {
return fmt.Sprintf("asynq:{%s}:pending", qname)