14 lines
325 B
Go
14 lines
325 B
Go
package ip_tool
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
)
|
|
|
|
// Cache 定义缓存接口,遵循接口隔离原则
|
|
type ICacheAdapter interface {
|
|
Set(ctx context.Context, ip string, info ApiResult, ttl time.Duration) error
|
|
Get(ctx context.Context, ip string) (*ApiResult, error)
|
|
Exists(ctx context.Context, ip string) (bool, error)
|
|
}
|