2

We recently upgraded the ServiceStack DLLs in our project from version 4.0.38 to version 4.0.52. We are making a call like this:

var clientManager = new BasicRedisClientManager("127.0.0.1");
var client = clientManager.GetClient();
client.Db = 3; // set the DB to 3
var item = DateTime.Now.Ticks.ToString();
client.AddItemToList("test_q", item);

In version 4.0.38 this call correctly resulted in an item in the test_q list in DB 3 (select 3). However when we upgraded to version 4.0.52 the setting of the DB to 3 no longer works and the item ends up in the default DB 0.

Is this a bug or is there a change in the API?

Tim Ojo
  • 103
  • 6

1 Answers1

3

This was a change in behavior that's now resolved in this commit which is due to GetClient() now returning an already connected client. This change is available from v4.0.53 that's now available on MyGet.

One way to force a Database change to an already connected client is to use the explicit ChangeDb() API, e.g:

((RedisClient)client).ChangeDb(3);

Another option is to specify the Db in the connection string, e.g:

var clientManager = new BasicRedisClientManager("127.0.0.1?db=3");
mythz
  • 141,670
  • 29
  • 246
  • 390