20 lines
532 B
Go
20 lines
532 B
Go
package queue
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
)
|
|
|
|
type Status struct {
|
|
Sessions int64
|
|
}
|
|
|
|
type Adapter interface {
|
|
// Touch updates the session TTL and returns its current rank
|
|
Touch(ctx context.Context, queueName string, sessionId string) (int64, error)
|
|
// Status returns the queue current status
|
|
Status(ctx context.Context, queueName string) (*Status, error)
|
|
// Refresh forces a refresh of the queue, taking into account the given TTL for sessions
|
|
Refresh(ctx context.Context, queueName string, keepAlive time.Duration) error
|
|
}
|