30 lines
635 B
Go
30 lines
635 B
Go
package l_export_async
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"github.com/redis/go-redis/v9"
|
|
)
|
|
|
|
type redisTaskStore struct {
|
|
client *redis.Client
|
|
}
|
|
|
|
func (r *redisTaskStore) Set(ctx context.Context, key string, value interface{}, expiration time.Duration) TaskErr {
|
|
return r.client.Set(ctx, key, value, expiration)
|
|
}
|
|
|
|
func (r *redisTaskStore) Del(ctx context.Context, keys ...string) TaskErr {
|
|
|
|
return r.client.Del(ctx, keys...)
|
|
}
|
|
|
|
func (r *redisTaskStore) Get(ctx context.Context, key string) TaskGet {
|
|
return r.client.Get(ctx, key)
|
|
}
|
|
|
|
func NewRedisTaskStore(client *redis.Client) TaskSaveTool {
|
|
return &redisTaskStore{client: client}
|
|
}
|