stackexchange.redis

Azure Redis Session State error Timeout performing EVAL, inst:1 , queue:2

冷暖自知 提交于 2019-12-10 12:39:35
问题 We are using azure redis cache and was working fine until today where we faced the issue below. Timeout performing GET {key}, inst: 1, queue: 2, qu=0, qs=2, qc=0, wr=0/0, in=0/0' Could someone please help me understand: What is causing it? How to solve and stop from happening? 回答1: Please read the following post on how to debug this http://azure.microsoft.com/blog/2015/02/10/investigating-timeout-exceptions-in-stackexchange-redis-for-azure-redis-cache/ 来源: https://stackoverflow.com/questions

What does StackExchange.Redis do with the configured Masters/Slaves?

本小妞迷上赌 提交于 2019-12-10 10:17:54
问题 I'm looking at StackExchange.Redis and notice it has features for automatically determining which of the configured servers is master, and which are slaves. I've not managed to spot what StackExchange actually does with the configured Masters/Slaves. Does it always run commands on Master, and only use configured Slaves for failover? Or is the answer more in-depth than that? Any pointers appreciated! 回答1: The key thing here is CommandFlags , a parameter on every method. By default, most are

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

喜欢而已 提交于 2019-12-10 09:52:49
问题 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)

Azure Redis StackExchange.Redis ConnectionMultiplexer in ASP.net MVC

こ雲淡風輕ζ 提交于 2019-12-10 03:52:19
问题 I have read that in order to connect to Azure Redis cache is best to follow this practice: private static ConnectionMultiplexer Connection { get { return LazyConnection.Value; } } private static readonly Lazy<ConnectionMultiplexer> LazyConnection = new Lazy<ConnectionMultiplexer>( () => { return ConnectionMultiplexer.Connect(connStinrg); }); And according to Azure Redis docs: The connection to the Azure Redis Cache is managed by the ConnectionMultiplexer class. This class is designed to be

StackExchange.Redis async call hangs

不打扰是莪最后的温柔 提交于 2019-12-09 12:28:47
问题 Trying to figure out why this code hangs. I can remove any one of the 3 lines at the bottom of the test and it won't hang, but all 3 together makes it hang. Any help would be greatly appreciated! [Fact] public async Task CanAddValuesInParallel() { var muxer = ConnectionMultiplexer.Connect("localhost"); var db = muxer.GetDatabase(); await AddAsync(db, "test", "1"); await db.KeyDeleteAsync("test"); Task.Run(() => AddAsync(db, "test", "1")).Wait(); } public async Task<bool> AddAsync(IDatabase db

Parallel execution with StackExchange.Redis?

ⅰ亾dé卋堺 提交于 2019-12-09 06:15:10
问题 I have a 1M items store in List<Person> Which I'm serializing in order to insert to Redis. (2.8) I divide work among 10 Tasks<> where each takes its own section ( List<> is thread safe for readonly ( It is safe to perform multiple read operations on a List ) Simplification : example: For ITEMS=100 , THREADS=10 , each Task will capture its own PAGE and deal with the relevant range. For exaple : void Main() { var ITEMS=100; var THREADS=10; var PAGE=4; List<int> lst = Enumerable.Range(0,ITEMS)

Get values by key pattern in StackExchange.Redis

泄露秘密 提交于 2019-12-08 17:28:24
问题 I'm trying to use a pattern to retrieve all keys matching a pattern by Stackexchange.Redis . Code KEYS *o* 回答1: On the project homepage is linked Where are KEYS, SCAN, FLUSHDB etc? which gives full details on how to access this, and why it isn't on IDatabase . I should point out that you should avoid KEYS on a production server. The library will automatically try to use SCAN instead if it is available - which is less harmful but should still be treated with some caution. It would be

Using Redis to implement login?

◇◆丶佛笑我妖孽 提交于 2019-12-08 10:17:46
问题 We're using Redis to implement login mechanism between 2 servers over a vpn. So basically it's : How we did it ? At server1 side we do : string RandomNum = Guid.NewGuid().Tostring("N"); sub.Subscribe("DO_LOGIN"+RandomNum,(channel,message)=>{ //listen to specific (!) response ... }); sub.Publish("Do_LOGIN",{ ...data , RandomNum}); While server2 is already listening via : sub.Subscribe("DO_LOGIN",(channel,message) => { //read message values + extract RandomNum from the message //check DB if

StackExchange.Redis: Batch access for multiple hashes

一曲冷凌霜 提交于 2019-12-08 04:17:33
问题 So I need to access in bulk many different hashes (in StackExchange.Redis, I have different RedisKey's). What is the best (fastest) way to do it? For example, for these two possible implementations, is either correct? Which one works better? List<Task<HashEntry[]>> list = new List<Task<HashEntry[]>>(); List<RedisKey> keys; //Previously initialized list of keys foreach (var key in keys) { var task = db.HashGetAllAsync(key); list.Add(task); } await Task.WhenAll(list); 2. List<Task<HashEntry[]>>

StackExchange.Redis Lua script error in for loop

安稳与你 提交于 2019-12-08 04:08:52
问题 I am facing a problem with the Lua script (please find it below) in the StackExchange.Redis. I have dissected the code and got all of it working except for the last loop. I get the following as error -- ERR Protocol error: expected '$', got ' ' The error message is quite generic in nature, as it gives me the same error message for different types of errors. Can someone help me to figure out the problem? var doesExist = (bool)db.ScriptEvaluate(@" local function isDateInRange(DateStart, DateEnd