Menu
  • HOME
  • TAGS

Can StackExchange.Redis be used to store POCO?

c#,redis,stackexchange.redis,servicestack.redis

StackExchange.Redis can store Redis Strings, which are binary safe. That means, that you can easily serialize a POCO using the serialization technology of your choice and put it in there. The following example uses the .NET BinaryFormatter. Please note that you have to decorate your class with the SerializableAttribute to...

Redis throw exception “System.OutOfMemoryException”

asp.net,caching,redis,servicestack,servicestack.redis

First, you could be using StackExchange.Redis, Service Stack has some limitations (Free version). Second, you could use Binary as following: public static byte[] Serialize(object value) { if (value == null) return null; if (!value.GetType().IsSerializable) return null; byte[] result; using (var stream = new MemoryStream()) { var formatter = new BinaryFormatter();...

Retrieve selection of servicestack redis session objects based on values of properties

redis,servicestack,stackexchange.redis,servicestack.redis,servicestack-auth

Instead of SearchKeys you want to be using the newer Redis Scan API's which let you iterate over keys in a cursor. Redis values are blobbed and not indexed so there's not much opportunity to optimize this. The most efficient way would be to inspect the values using a custom...

ServiceStack Cannot Set Session with Redis

servicestack,servicestack.redis

It appears that I had installed an older version of Redis 2.4.6, and that service was still running. By uninstalling it, and installing Redis 2.8.19, the issue was resolved.

How to setup container to use with ServiceSTack.Redis

c#,redis,servicestack.redis

If you don't have (or want to use) an IOC Container you can just hold a singleton reference to the Redis Pool, e.g: class MyApp { public static IRedisClientsManager RedisManager = new RedisManagerPool(connString); } Which you can then reference in your code to access a RedisClient, e.g: using (var redis...

ServiceStack minimum configuration to get Redis Pub/Sub working between multiple Web sites/services

servicestack,servicestack.redis

The minimum code for a publisher is just: var redisManager = container.Resolve<IRedisClientsManager>(); using (var mqProducer = new RedisMessageProducer(redisManager)) { mqProducer.Publish(new Msg { ... }); } You could also use a MessageFactory: var msgFactory = new RedisMessageFactory(redisMangager); using (var mqClient = msgFactory.CreateMessageQueueClient()) { mqClient.Publish(new Msg { ... }); } ...

What is the difference between IRedisClientsManager and IRedisClientCacheManager in servicestack.redis

servicestack,servicestack.redis

Use IRedisClientsManager, which is the recommended default.

How to use ServiceStack Redis API?

c#,api,redis,servicestack,servicestack.redis

The IRedisTypeClient interface provides a typed version of the Redis Client API where all its API's accept a typed POCOs (i.e. Plain Old CSharp Object) for its value body which is in contrast to IRedisClient which just accepts raw strings. Behind the scenes the Typed API's just serialize the POCO's...

ServiceStack.Redis Unable to read transport - BasicRedisClientManager

redis,servicestack,servicestack.redis

You shouldn't hold any singleton instances of RedisClient or IRedisTypedClient<BarSet> which both encapsulates a non thread-safe Redis TCP Connection. You can instead hold singleton instances of IRedisClientsManager - which is its purpose to provide a thread-safe Redis Client Factory (like a DB Connection Pool). If you're also using ServiceStack Services,...

Redis - Loading Dataset is Memory Sport:

redis,servicestack.redis

Loading dataset error message happens in two cases: At master startup. When a slave reconnects and performs a full resynchronization with a master. The app should be able to deal with it, and retry a query or handle the failure in a graceful way....

How to properly register Redis Master and Slaves with ServiceStack Client Managers?

redis,servicestack,servicestack.redis

The RedisSentinel support in ServiceStack.Redis is available in the RedisSentinel class but as it's still being tested, it's not yet announced. You can find some info on how to use and configure a RedisSentinel in this previous StackOverflow Answer. Configuring a RedisSentinel When using a Redis Sentinel, it's the redis...

How could I add a delay in processing failed messages in ServiceStack Redis MQ

servicestack,mq,servicestack.redis,redismqserver

When you register a MQ handler you can also register an error handler which gets called after publishing a failed message which you can use to add a custom delay, e.g: mqServer.RegisterHandler<MyRequest>( ServiceController.ExecuteMessage, (msgHandler, msg, ex) => Thread.Sleep(1000)); ...

Flushing portions of a Redis cache

redis,servicestack.redis

I can think of three approaches to achieve that. Shared Databases - Worst Approach (as in highly recommended not to pursuit) Redis supports shared databases that are basically separate keyspaces managed by the same server. After connecting to your Redis, you switch between the databases with the SELECT statement and...

ServiceStack Message queue .outq max size is 100?

servicestack,servicestack-bsd,servicestack.redis

This is the default limit added on RedisMessageQueueClient.MaxSuccessQueueSize. The purpose of the .outq is to be a rolling log of recently processed messages. Clients can subscribe to the QueueNames.TopicOut to get notified when a message is published to the .outq....

servicestack server events with azure RedisServerEvents doesn't work, while default option MemoryServerEvents works

servicestack,servicestack.redis

oh God.. Finally I found what the issue is.. It had nothing to do with server events code or its confguration!!! But I have the following line used in my application for a different purpose and which had impact on server events! // Set the default reuse scope for the...

ServiceStack PooledRedisClient Timeout exception

c#,redis,servicestack,servicestack.redis

I wouldn't have a pool size that big, keeping 10000 open connections seems worse than not having any connection pooling at all. You also don't need specify ReuseScope.Container since the default is to use a singleton which is the correct scope for a manager/factory, so I would first try the...

Error when using Redis with C# : value is not an integer or out of range, sPort: 51410, LastCommand:

c#,c#-4.0,redis,servicestack.redis

Figured out the solution: I was using the older version of all the required ServiceStack dll's for Redis, downloaded the new versions of all the required dll's and it works flawlessly now....

ServiceStack Redis problems with simultaneous read requests

c#,redis,odata,servicestack.redis,structuremap3

The error messages are indicative of using a non-thread-safe instance of the RedisClient across multiple threads since it's getting responses to requests it didn't expect/send. To ensure your using correctly I only would pass in the Thread-Safe IRedisClientsManager singleton, e.g: public EventMonitorCache([NotNull]IRedisClientsManager redisManager) { this.redisManager = redisManager; } Then explicitly...

Redis insertion to hash is VERY(!) slow?

c#,performance,redis,.net-4.5,servicestack.redis

Please read http://redis.io/topics/benchmarks Your peformance bottleneck is probably related to the number of roundtrips between your application and the redis server. You need to use pipelining, or use concurrent connections, or both, in order to maximize the throughput. See examples of pipelining usage at: https://github.com/ServiceStack/ServiceStack.Redis/blob/master/tests/ServiceStack.Redis.Tests/RedisPipelineTests.cs Last point: Windows is certainly...

How to unit test Service Stacks Redis Client with Moq

unit-testing,servicestack,moq,servicestack.redis

In short, since RedisClient implements IRedisClient, did you try to create the mock using the interface? var instance = new Mock<IRedisClient>(); why are you using a real container for your unit test? You should use an auto-mocking container or simply (since you are already taking care of the mock manually)...

Redis client for C# (serviceStack) - where is the documentation?

c#,redis,servicestack.redis

For a full list of avilable API commands look here : For IRedisClient API see https://github.com/ServiceStack/ServiceStack.Redis/wiki/IRedisClient For IRedisNativeClient API see https://github.com/ServiceStack/ServiceStack.Redis/wiki/IRedisNativeClient...