stackexchange.redis

Handling of transient network errors with StackExchange.Redis

核能气质少年 提交于 2019-12-08 02:43:33
问题 Looking for guidance on handling temporary network issues when using the StackExchange.Redis client. For clarification, I do not mean initially connecting to the Redis server with ConnectionMultiplexer.Connect(). I am referring to how to handle connections that are interrupted for whatever reason in the middle of an operation. (we can assume that the command is idempotent, StringSet, StringGet) I ask because we are migrating from the ServiceStack to the StackExchange client. In the code we

Should `StackExchange.Redis.ConnectionMultiplexer` be `AddStatic` or `AddScope` in .NET Core dependency injection?

倾然丶 夕夏残阳落幕 提交于 2019-12-07 03:26:38
问题 I'm adding a Redis connection to .NET Core using StackExchange.Redis , it currently looks something like this: public static IServiceCollection AddRedisMultiplexer( this IServiceCollection services, Func<ConfigurationOptions> getOptions = null) { // Get the options or assume localhost, as these will be set in Startup.ConfigureServices assume they won't change var options = getOptions?.Invoke() ?? ConfigurationOptions.Parse("localhost"); // The Redis is a singleton, shared as much as possible.

The correct way of using StackExchange.Redis

試著忘記壹切 提交于 2019-12-07 01:40:41
问题 The idea is to use less connection and better performance. Does the connection expire at any time? And for another question, does _redis.GetDatabase() open new connection? private static ConnectionMultiplexer _redis; private static IDatabase _db; public RedisCacheProvider(string configuration) { if (_redis == null) lock (myLock) if (_redis == null) { _redis = ConnectionMultiplexer.Connect(configuration); _db = _redis.GetDatabase(); } } public async Task<string> GetString(string key) { string

Handling of transient network errors with StackExchange.Redis

这一生的挚爱 提交于 2019-12-06 11:16:25
Looking for guidance on handling temporary network issues when using the StackExchange.Redis client. For clarification, I do not mean initially connecting to the Redis server with ConnectionMultiplexer.Connect(). I am referring to how to handle connections that are interrupted for whatever reason in the middle of an operation. (we can assume that the command is idempotent, StringSet, StringGet) I ask because we are migrating from the ServiceStack to the StackExchange client. In the code we are replacing, which uses ServiceStack, exceptions were caught and the operation would be attempted again

How to read multiple Sets stored on Redis using some command or LUA script

北城余情 提交于 2019-12-06 07:30:40
问题 I want to get all the sets from Redis using a list of keys in single call. As per the documentation, Redis provides SSCAN command for that but as I am using StackExchange.Redis as a Redis adapter, I guess this command does not have any such method in this adapter. So there two things I am looking for: I looking forward to execute SSCAN using the LUA script but was not able to find any such example over the internet. Can anyone share how to call SSCAN from LUA with multiple SET Keys. Also for

OAuth 2 Owin not working StackExchange.Redis SessionState

↘锁芯ラ 提交于 2019-12-06 04:04:42
问题 Starting with a fresh, new MVC5 Project I hooked up External OAuth Login with Google, Facebook Twitter, Microsoft etc. All is working as expected. I then added the new ASP.NET Session State Provider for Redis Preview Release and have it working. Yeah! I soon noticed that attempting to login using any of the OAuth providers no longer works properly. The Google & Facebook login buttons calls the ExternalLoginCallback(string returnUrl) on the Accont controller but goes nowhere. The login page

Password for Redis with StackExchange.Redis

寵の児 提交于 2019-12-06 01:52:28
How do you specify the password for the Redis server with StackExchange.Redis? I am guessing you add it to the configuration string which is passed to the Connect method. I can't seem to find the format in which it needs to be specified. I will add a full list of the key/value pairs to the configuration docs tomorrow. Short version is: probably "foo,password=value". Longer version is: use ConfgurationOptions and set .Password . The document shows you how to switch between the two layouts. 来源: https://stackoverflow.com/questions/23923247/password-for-redis-with-stackexchange-redis

Does Stackexchange.Redis' fire and forget guarantees delivery?

筅森魡賤 提交于 2019-12-05 20:27:15
问题 I understand that CommandFlags.FireAndForget is intended for situations that you don't care about the response. Does it also guarantee delivery even though the response isn't important for the running application? 回答1: Actually, the Redis protocol does not really support "fire and forget" operations. Except for pub/sub traffic, all Redis commands are matched with a reply, and there is no way to tell the Redis server to omit the reply. Now some clients (like StackExchange.Redis) simulates a

StackExchange TimeoutException when trying to insert 750 items in 2 sets in redis

随声附和 提交于 2019-12-05 20:03:39
Initially I'm trying to insert some collection of items into 2 redis sets (maybe this is not good idea at all, but ...). amount of entries that I'm trying to add at once: 750+ For now I do receive timeout exception when trying to perform this action using StackExchange.redis client, the interesting thing that I'm able to complete similar action using "legacy" booksleeve client I've investigated previously. So, I definitely wrong in something (even maybe in my intial bookSleeve implementation), just trying to figure out what exactly is wrong. Below is sample of the code that I use with redis

Should `StackExchange.Redis.ConnectionMultiplexer` be `AddStatic` or `AddScope` in .NET Core dependency injection?

ε祈祈猫儿з 提交于 2019-12-05 06:04:39
I'm adding a Redis connection to .NET Core using StackExchange.Redis , it currently looks something like this: public static IServiceCollection AddRedisMultiplexer( this IServiceCollection services, Func<ConfigurationOptions> getOptions = null) { // Get the options or assume localhost, as these will be set in Startup.ConfigureServices assume they won't change var options = getOptions?.Invoke() ?? ConfigurationOptions.Parse("localhost"); // The Redis is a singleton, shared as much as possible. return services.AddSingleton<IConnectionMultiplexer>(provider => ConnectionMultiplexer.Connect(options