20 lines
		
	
	
		
			626 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			626 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package cache
 | |
| 
 | |
| import (
 | |
| 	"context"
 | |
| 	"time"
 | |
| 
 | |
| 	"github.com/redis/go-redis/v9"
 | |
| )
 | |
| 
 | |
| type Cache interface {
 | |
| 	Encode(a any) ([]byte, error)
 | |
| 	Set(ctx context.Context, key string, value interface{}, expiration time.Duration) error
 | |
| 	Del(ctx context.Context, keys ...string) error
 | |
| 	Get(ctx context.Context, key string) (string, error)
 | |
| 	GetBytes(ctx context.Context, key string) ([]byte, error)
 | |
| 	Scan(ctx context.Context, cursor uint64, match string, count int64) *redis.ScanCmd
 | |
| 	Keys(ctx context.Context, pattern string) ([]string, error)
 | |
| 	ListKeys(ctx context.Context, pattern string, pageID int, pageSize int) ([]string, int, error)
 | |
| }
 |