How can I change b (redis command select) when I used the redis pool.
I want to record the host and read the host from different databases.
eg:
only now i have only one redis server so readWriteHosts = readOnlyHosts
pool = RedisDao.CreateManager(hostIp, hostIp); public static PooledRedisClientManager CreateManager(string[] readWriteHosts, string[] readOnlyHosts) { return new PooledRedisClientManager(readWriteHosts, readOnlyHosts, new RedisClientManagerConfig { MaxWritePoolSize = 50,
// here I want to use the DB number day% 15
using (var redis = pool.GetClient()) { RedisDB model = new RedisDB(); Dictionary<string, string> dic = redis.GetAllEntriesFromHash(keyPrefix + ID); model.ID = ID;
// here I want to use the database number (day-1)% 15
using (var redis = pool.GetClient()) {
EDIT:
I find a way to install different databases, but I think this solution is not the best way.
if(redis is RedisClient) { long db = redis.DB;
Do I need to block a thread? when I read or write redis. I'm afraid I have the same redis client in mutil-thread. then redis db is?
Change end
int time = DateTimeUtil.ConvertDateTimeInt(DateTime.Now); model.ID = time + redis.Increment(incrementKey, 1) + "";//.Incr("ID"); using (var pip = redis.CreatePipeline()) { pip.QueueCommand(r => r.AddItemToList(primaryKey, model.ID + "")); pip.Flush(); }; }; }
I got redisClient from the pool, but redisClient does not have changeDB function.
So will anyone tell me how to install it?