本文整理汇总了Java中org.redisson.SingleServerConfig类的典型用法代码示例。如果您正苦于以下问题:Java SingleServerConfig类的具体用法?Java SingleServerConfig怎么用?Java SingleServerConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SingleServerConfig类属于org.redisson包,在下文中一共展示了SingleServerConfig类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SingleConnectionManager
import org.redisson.SingleServerConfig; //导入依赖的package包/类
public SingleConnectionManager(SingleServerConfig cfg, Config config) {
MasterSlaveServersConfig newconfig = new MasterSlaveServersConfig();
String addr = cfg.getAddress().getHost() + ":" + cfg.getAddress().getPort();
newconfig.setRetryAttempts(cfg.getRetryAttempts());
newconfig.setRetryInterval(cfg.getRetryInterval());
newconfig.setTimeout(cfg.getTimeout());
newconfig.setPingTimeout(cfg.getPingTimeout());
newconfig.setPassword(cfg.getPassword());
newconfig.setDatabase(cfg.getDatabase());
newconfig.setClientName(cfg.getClientName());
newconfig.setMasterAddress(addr);
newconfig.setMasterConnectionPoolSize(cfg.getConnectionPoolSize());
newconfig.setSubscriptionsPerConnection(cfg.getSubscriptionsPerConnection());
newconfig.setSlaveSubscriptionConnectionPoolSize(cfg.getSubscriptionConnectionPoolSize());
init(newconfig, config);
}
示例2: getRedissonStoreFactory
import org.redisson.SingleServerConfig; //导入依赖的package包/类
public RedissonStoreFactory getRedissonStoreFactory() {
// TODO 这里现在使用的Redis单点
String[] addresses = redisAddresses.split(",");
Config config = new Config();
SingleServerConfig singleServerConfig = config.useSingleServer();
singleServerConfig.setAddress(addresses[0]);
singleServerConfig.setDatabase(redisDB);
singleServerConfig.setTimeout(3000);
singleServerConfig.setConnectionPoolSize(50);
RedissonClient redissonClient = Redisson.create(config);
return new RedissonStoreFactory(redissonClient);
}