servicestack.redis

Getting Redis Master address from Sentinel C#

Deadly 提交于 2019-12-24 04:34:57
问题 I am trying to use the sentinel to get the connection address of my master, the problem is that the sentinel sends the address only on failover, but if my master is down and the slave was promoted master and my application is just booted it would not know and won't get the message that the original master is down, is there any way to communicate with the sentinel and ask him who he thinks the master is using C# servicestack redis client? 回答1: Had to do it the hard way, I imitate the redis-cli

How to increase Redis performance when 100% CPU? Sharding? Fastest .Net Client?

五迷三道 提交于 2019-12-18 12:40:12
问题 Due to massive load increases on our website redis is now struggling with peak load because the redis server instance is reaching 100% CPU (on one of eight cores) resulting in time outs. We've updated our client software to ServiceStack V3 (coming from BookSleeve 1.1.0.4) and upgraded the redis server to 2.8.11 (coming from 2.4.x). I chose ServiceStack due to the existence of the Harbour.RedisSessionStateStore that uses ServiceStack.Redis. We used AngiesList.Redis before together with

Redis distributed increment with locking

假如想象 提交于 2019-12-18 11:56:38
问题 I have a requirement for generating an counter which will be send to some api calls. My application is running on multiple node so some how I wanted to generate unique counter. I have tried following code public static long GetTransactionCountForUser(int telcoId) { long valreturn = 0; string key = "TelcoId:" + telcoId + ":Sequence"; if (Muxer != null && Muxer.IsConnected && (Muxer.GetDatabase()) != null) { IDatabase db = Muxer.GetDatabase(); var val = db.StringGet(key); int maxVal = 999; if

How to store list element in Redis cache

戏子无情 提交于 2019-12-12 07:09:43
问题 I have used StackExchange.Redis for c# redis cache. cache.StringSet("Key1", CustomerObject); but I want to store data like cache.StringSet("Key1", ListOfCustomer); so that one key has all Customer List stored and it is easy to search,group,filter customer Data also inside that List Answers are welcome using ServiceStack.Redis or StackExchange.Redis 回答1: You can use ServiceStack.Redis high-level IRedisTypedClient Typed API for managing rich POCO Types. First get a typed Redis client for

Bulk create keys in Redis - ServiceStack C#

丶灬走出姿态 提交于 2019-12-12 02:22:59
问题 Is there any way to bulk-create keys ( SETS ) in " Redis ServiceStack client "? Of course, without putting for loop. There is one command in Redis which does this: MSET but, I couldn't find any implementation of this command in ServiceStack.Redis client. Ex: MSET key1 "val1" key2 "val2" UPDATE: @mythz suggested a way to create multiple SETS but with single member SETALL(). Additionally, I found a way to bulk add members to a single set by AddRangeToSet(string setId, List items) But, is there

ServiceStack.Redis multi-threading collision

 ̄綄美尐妖づ 提交于 2019-12-11 14:24:57
问题 I have a ServiceStack.Redis multi-threading collision. I have a kind of non-standard usage case for ServiceStack where I capture all routes in one "FallbackRoute". This means there is one service for that one route. Here is the DTO: [FallbackRoute("/{Path*}")] public class S3Request : IRequiresRequestStream{ public string Path{ get; set; } public Stream RequestStream { get; set; } } The Service is: public class S3Service : Service { public RedisUsersCredentials RedisUsersCredentials { get;

How to get ,update all keys and its values from redis database in c#?

蹲街弑〆低调 提交于 2019-12-11 13:43:35
问题 I am using servicestack C# driver for connecting redis database which runs in 6379. I want to retrieve(GET/READ) all keys and its values from redis database(which is actually cached). I have to update two keys and its values in redisdb, is it possible to make an update without using list or hashtypes? I want to know how to add numerous keys and values as well as update many at a time. 回答1: With respect to Redis you want multiple update, multiple get and multiple add. You can use these

Protocol errors, “no more data” errors, “Zero length response” errors while using servicestack.redis in a high volume scenario

久未见 提交于 2019-12-11 03:47:28
问题 Would really help if someone tell me if there are issues with PooledRedisClientManager under high volume scenarios? I am using a singleton client manager that gets called for GetClient() by multiple WCF threads 1000's of times in a min and each thread can read/update/insert into a Redis collection (am using redis hash collection). Intermittently i see these errors and usually go away on Retries. All GetClient() calls are within Using statements. Thanks Rb Here are the errors I see from the

Using Redis as Cache and C# client

拈花ヽ惹草 提交于 2019-12-10 21:10:23
问题 I'm new to Redis and trying to figure out a simple way to use Redis as a local cache for my C# app. I've downloaded and ran the redis-server from https://github.com/MSOpenTech/redis/releases I can successfully store a key value and retrieve it as follows: var redisManager = new PooledRedisClientManager("localhost:6379"); using (var redis = redisManager.GetClient()) { redis.Set("mykey_1", 15, TimeSpan.FromSeconds(3600)); // get typed value from cache int valueFromCache = redis.Get<int>("mykey

ServiceStack.Redis: Unable to Connect: sPort: 50071

久未见 提交于 2019-12-10 14:35:02
问题 I'm using the ServiceStack Redis Client and I was hoping that I could get a clarification on what might cause the following error ... "Unable to Connect: sPort: 50071"? I'm using the "PooledRedisClientManager" object for connections. Thanks for any assistance. 回答1: IF YOU ARE USING A SELF HOSTED REDIS SERVER AND USING THE Service Stack Redis Client THEN BUYER BEWARE As of 9/23/2015 Service Stack does license validation in the client code (rather than the server). If you are ripping through a