public static void PipelineSet <T>(int tenantId, string key, T value, Action onSuccess = null, Action <Exception> onException = null) { using (var redis = new RedisNativePipelineProviderV2(REDIS_CACHE_KEYSPACE, tenantId)) { var serializedValue = JsonConvert.SerializeObject(value); redis.Set(key, StringToBytes(serializedValue), onSuccess, onException); redis.Flush(); } }
public static void PipelineSet <T>(int tenantId, string key, T value, Action onSuccess = null, Action <Exception> onException = null) { try { using (var redis = new RedisNativePipelineProviderV2(RedisCacheKeyspace, tenantId)) { var serializedValue = JsonConvert.SerializeObject(value); redis.Set(key, StringToBytes(serializedValue), onSuccess, onException); redis.Flush(); } } catch (Exception ex) { LogHelper.Instance.Error(string.Format("在redis创建[{0}]:[{1}]异常", key, value), ex); throw; } }