public static async Task RecordSend(RedisSettings usedSettings, string key, string callType, Func <Task <object> > executeAndReturnSentObject, [CallerMemberName] string commandName = "") { var tracerFactory = usedSettings.CommandTracerFactory; ICommandTracer tracer = null; if (tracerFactory != null) { tracer = tracerFactory(); var command = callType + "." + commandName; tracer.CommandStart(usedSettings, command, key); // start within context } object sendObject = null; bool isError = true; try { sendObject = await executeAndReturnSentObject().ConfigureAwait(false); isError = false; } finally { if (tracer != null) { tracer.CommandFinish(sendObject, null, isError); // finish without context } } }
public static async Task <T> RecordSendAndReceive <T>(RedisSettings usedSettings, string key, string callType, Func <Task <Pair <T> > > executeAndReturnSentAndReceivedObject, [CallerMemberName] string commandName = "") { var tracerFactory = usedSettings.CommandTracerFactory; ICommandTracer tracer = null; if (tracerFactory != null) { tracer = tracerFactory(); var command = callType + "." + commandName; tracer.CommandStart(usedSettings, command, key); // start within context } object sendObject = null; T receivedObject = default(T); bool isError = true; try { var sendAndReceivedObject = await executeAndReturnSentAndReceivedObject().ConfigureAwait(false); sendObject = sendAndReceivedObject.SentObject; receivedObject = sendAndReceivedObject.ReceivedObject; isError = false; } finally { if (tracer != null) { tracer.CommandFinish(sendObject, receivedObject, isError); // finish without context } } return(receivedObject); }
public RedisSessionOptions(RedisSettings redisSettings) { if (redisSettings == null) throw new ArgumentNullException("redisSettings"); this.redisSettings = redisSettings; SetDefault(); }
public RedisSubject(RedisSettings settings, string key, PubSubKeyType keyType = PubSubKeyType.Normal) { this.settings = settings; this.Db = settings.Db; this.valueConverter = settings.ValueConverter; this.Key = key; this.keyType = keyType; }
/// <summary> /// Use RedisSession. After enabled, you can take RedisSession from environment.AsRedisSession(). /// </summary> public static IAppBuilder UseRedisSession(this IAppBuilder app, RedisSettings redis) { return app.Use(typeof(RedisSessionMiddleware), redis); }
public RedisSessionMiddleware(AppFunc next, RedisSettings redis) : this(next, new RedisSessionOptions(redis)) { }
public RedisList(RedisSettings settings, string listKey) { this.Settings = settings; this.Key = listKey; }
public RedisSet(RedisSettings settings, string stringKey) { this.Settings = settings; this.Key = stringKey; }
public RedisGroup(string groupName, RedisSettings[] settings, IServerSelector selector = null) { this.GroupName = groupName; this.Settings = settings; this.serverSelector = selector ?? new SimpleHashingSelector(); }
public RedisSettings Select(RedisSettings[] settings, string key) { if (settings.Length == 0) throw new ArgumentException("settings length is 0"); if (settings.Length == 1) return settings[0]; using (var md5 = new System.Security.Cryptography.MD5CryptoServiceProvider()) { var hashBytes = md5.ComputeHash(Encoding.UTF8.GetBytes(key)); var seed = System.Math.Abs(BitConverter.ToInt32(hashBytes, 0)); var index = seed % settings.Length; return settings[index]; } }
public void CommandStart(RedisSettings usedSettings, string command, string key) { this.timelineRegion = RedisInspector.Start(command, key); }
public RedisDictionary(RedisSettings settings, string hashKey) { this.Settings = settings; this.Key = hashKey; }
public RedisClass(RedisSettings settings, string hashKey) { this.Settings = settings; this.Key = hashKey; }