This commit is contained in:
lzh
2025-06-18 17:37:21 +08:00
parent 695dcf3c49
commit e2d9685db3
3 changed files with 17 additions and 28 deletions

View File

@@ -51,6 +51,14 @@ func (r *RedisCacheAdapter) Del(ctx context.Context, key string) error {
return r.client.Del(ctx, key).Err()
}
func (r *RedisCacheAdapter) SetNX(ctx context.Context, key string, value interface{}, expire time.Duration) (ok bool, err error) {
data, err := json.Marshal(value)
if err != nil {
return false, err
}
return r.client.SetNX(ctx, key, data, expire).Result()
}
var (
//SMS
accessKeyId = os.Getenv("SMS_ALIBABA_CLOUD_ACCESS_KEY_ID")