当前位置: 首页>>代码示例>>Java>>正文


Java RedisURI.Builder方法代码示例

本文整理汇总了Java中com.lambdaworks.redis.RedisURI.Builder方法的典型用法代码示例。如果您正苦于以下问题:Java RedisURI.Builder方法的具体用法?Java RedisURI.Builder怎么用?Java RedisURI.Builder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.lambdaworks.redis.RedisURI的用法示例。


在下文中一共展示了RedisURI.Builder方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: connect

import com.lambdaworks.redis.RedisURI; //导入方法依赖的package包/类
/**
 * Connects to the Redis server.
 * @param configuration The configuration object.
 * @throws Exception If an error occurs.
 */
public void connect(Configuration configuration) throws Exception {
    if(sync != null) {
        return;
    }
    RedisURI.Builder uri = RedisURI.Builder.redis(configuration.getRedisHost(), configuration.getRedisPort())
            .withDatabase(configuration.getRedisIndex());
    if(!configuration.getRedisAuth().isEmpty()) {
        uri.withPassword(configuration.getRedisAuth());
    }
    RedisClient client = RedisClient.create(uri.build());
    StatefulRedisConnection<String, String> connection = client.connect();
    sync = connection.sync();
    for(Category category : Category.values()) {
        logger.info("Registered the category {} with the type {}.", category, category.getEntry().getType());
        category.getEntry().setCategory(category);
    }
}
 
开发者ID:Arraying,项目名称:Arraybot,代码行数:23,代码来源:Redis.java

示例2: apply

import com.lambdaworks.redis.RedisURI; //导入方法依赖的package包/类
@Override
public StatefulRedisConnection<K, V> apply(ConnectionKey key) {

    RedisURI.Builder builder = RedisURI.Builder
            .redis(key.host, key.port)
            .withSsl(initialRedisUri.isSsl())
            .withVerifyPeer(initialRedisUri.isVerifyPeer())
            .withStartTls(initialRedisUri.isStartTls());

    if (initialRedisUri.getPassword() != null && initialRedisUri.getPassword().length != 0) {
        builder.withPassword(initialRedisUri.getPassword());
    }

    if (initialRedisUri.getClientName() != null) {
        builder.withClientName(initialRedisUri.getClientName());
    }
    builder.withDatabase(initialRedisUri.getDatabase());

    StatefulRedisConnection<K, V> connection = redisClient.connect(redisCodec, builder.build());

    synchronized (stateLock) {
        connection.setAutoFlushCommands(autoFlushCommands);
    }

    return connection;
}
 
开发者ID:lettuce-io,项目名称:lettuce-core,代码行数:27,代码来源:MasterSlaveConnectionProvider.java

示例3: RedisMasterSlaveNode

import com.lambdaworks.redis.RedisURI; //导入方法依赖的package包/类
RedisMasterSlaveNode(String host, int port, RedisURI seed, Role role) {

        RedisURI.Builder builder = RedisURI.Builder
                .redis(host, port)
                .withSsl(seed.isSsl())
                .withVerifyPeer(seed.isVerifyPeer())
                .withStartTls(seed.isStartTls());
        if (seed.getPassword() != null && seed.getPassword().length != 0) {
            builder.withPassword(new String(seed.getPassword()));
        }

        if (seed.getClientName() != null) {
            builder.withClientName(seed.getClientName());
        }

        builder.withDatabase(seed.getDatabase());

        this.redisURI = builder.build();
        this.role = role;
    }
 
开发者ID:lettuce-io,项目名称:lettuce-core,代码行数:21,代码来源:RedisMasterSlaveNode.java

示例4: configureRedisUri

import com.lambdaworks.redis.RedisURI; //导入方法依赖的package包/类
private RedisURI configureRedisUri(Hosts.HostAndPort hostAndPort) {
	RedisURI.Builder builder = redis( hostAndPort.getHost(), hostAndPort.getPort() );
	builder.withSsl( config.isSsl() );
	builder.withDatabase( config.getDatabaseNumber() );

	if ( config.getPassword() != null ) {
		builder.withPassword( config.getPassword() );
	}

	builder.withTimeout( config.getTimeout(), TimeUnit.MILLISECONDS );
	return builder.build();
}
 
开发者ID:hibernate,项目名称:hibernate-ogm-redis,代码行数:13,代码来源:RedisDatastoreProvider.java


注:本文中的com.lambdaworks.redis.RedisURI.Builder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。