redis_client.go 696 B

1234567891011121314151617181920
  1. package redis
  2. import (
  3. "context"
  4. "time"
  5. )
  6. // redis接口
  7. type RedisClient interface {
  8. GetString(key string) string
  9. GetStringWithContext(ctx context.Context, key string) string
  10. SetString(key string, val string, timeout time.Duration) error
  11. SetStringWithContext(ctx context.Context, key string, val string, timeout time.Duration) error
  12. Delete(key string) error
  13. DeleteWithContext(ctx context.Context, key string) error
  14. IsExist(key string) bool
  15. IsExistWithContext(ctx context.Context, key string) bool
  16. Do(commandName string, args ...interface{}) (reply interface{}, err error)
  17. DoWithContext(ctx context.Context, commandName string, args ...interface{}) (reply interface{}, err error)
  18. }