My problem is saving and reading a zip file to a Redis Cache database which located onAzure. I tried something with StackExchange.Redis but I did not managed it. Do you know any example or solution about that?
My Code like that.For this code I am getting time-out error.
ConnectionMultiplexer connection = ConnectionMultiplexer.Connect("filecache.redis.cache.windows.net:6380,password=123,ssl=True,abortConnect=False");
IDatabase cache = connection.GetDatabase();
byte[] fileBytes = File.ReadAllBytes(@"c:\test.zip");
var str = Convert.ToBase64String(fileBytes);
cache.StringSet("f1", str);
var key1 = cache.StringGet("f1");
And this is the Error:
StackExchange.Redis.RedisTimeoutException occurred HResult=0x80131505 Message=Timeout performing SET f1, inst: 0, mgr: Inactive, err: never, queue: 2, qu: 1, qs: 1, qc: 0, wr: 1, wq: 1, in: 0, ar: 0, clientName: NLBRLT-MCOPUR, serverEndpoint: Unspecified/BatchReportCache.redis.cache.windows.net:6380, keyHashSlot: 2046, IOCP: (Busy=0,Free=1000,Min=4,Max=1000), WORKER: (Busy=0,Free=2047,Min=4,Max=2047) (Please take a look at this article for some common client-side issues that can cause timeouts: http://stackexchange.github.io/StackExchange.Redis/Timeouts) Source=StackExchange.Redis
Firstly, I don't suggest you upload large files to redis cache.
The reason why you get this error is about you upload large file to redis cache. It takes a lot of time to upload file and meet the connect limit.
Redis is design for small size cache not large files, if you want to upload large file, please using azure storage. More details, you could refer to this article.
If you still want to upload large file to it, you could change the synctimeout value in connection string.
Change it as this:
ynctimeout=100000(this value is about when your request will time out),{redisname}.redis.cache.windows.net:6380,password={key},ssl=True,abortConnect=False
The test demo on side.
It takes almost 20 seconds to upload the zip to redis.
User contributions licensed under CC BY-SA 3.0