com.lambdaworks.redis.RedisConnection Java Examples

The following examples show how to use com.lambdaworks.redis.RedisConnection. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RedisCacheServiceBuilder.java    From registry with Apache License 2.0 5 votes vote down vote up
private Factory<RedisConnection> getRedisConnectionFactory() {
    final ConnectionConfig.RedisConnectionConfig connectionConfig = (ConnectionConfig.RedisConnectionConfig) cacheConfig.getConnectionConfig();

    if (connectionConfig != null) {
        if (connectionConfig.getPool() != null) {
            return new RedisConnectionPoolFactory(RedisClient.create(getRedisUri()), getRedisCodec());
        } else {
            return new RedisConnectionFactory(RedisClient.create(getRedisUri()), getRedisCodec());
        }
    }
    return null;
}
 
Example #2
Source File: DoTestLettuceHookProxy.java    From uavstack with Apache License 2.0 5 votes vote down vote up
private static void testSync() {

        System.out.println("TEST Lettuce sync ======================================================");
        RedisClient redisClient = RedisClient.create("redis://localhost:6379/0");
        RedisConnection<String, String> conn = redisClient.connect();

        System.out.println("Connected to Redis");

        conn.set("foo", "bar");
        String value = conn.get("foo");
        System.out.println(value);

        conn.close();
        redisClient.shutdown();
    }
 
Example #3
Source File: RedisCacheServiceBuilder.java    From streamline with Apache License 2.0 5 votes vote down vote up
private Factory<RedisConnection> getRedisConnectionFactory() {
    final ConnectionConfig.RedisConnectionConfig connectionConfig = (ConnectionConfig.RedisConnectionConfig) cacheConfig.getConnectionConfig();

    if (connectionConfig != null) {
        if (connectionConfig.getPool() != null) {
            return new RedisConnectionPoolFactory(RedisClient.create(getRedisUri()), getRedisCodec());
        } else {
            return new RedisConnectionFactory(RedisClient.create(getRedisUri()), getRedisCodec());
        }
    }
    return null;
}
 
Example #4
Source File: RedisCacheTestMain.java    From streamline with Apache License 2.0 4 votes vote down vote up
public static RedisConnection<String, String> getConnection1() {
    return connection1;
}
 
Example #5
Source File: RedisCacheTestMain.java    From streamline with Apache License 2.0 4 votes vote down vote up
public static RedisConnection<String, String> getConnection() {
    return connection;
}
 
Example #6
Source File: RedisConnectionFactory.java    From streamline with Apache License 2.0 4 votes vote down vote up
@Override
public RedisConnection<K, V> create() {
    return redisClient.connect(codec);
}
 
Example #7
Source File: RedisConnectionPoolFactory.java    From streamline with Apache License 2.0 4 votes vote down vote up
public RedisConnection<K, V> create() {
    return redisClient.pool(codec, MAX_IDLE, MAX_ACTIVE).allocateConnection();
}
 
Example #8
Source File: RedisHashesCache.java    From streamline with Apache License 2.0 4 votes vote down vote up
public RedisHashesCache(RedisConnection<K, V> redisConnection, K key, ExpiryPolicy expiryPolicy) {
    super(redisConnection, expiryPolicy);
    this.key = key;
}
 
Example #9
Source File: RedisHashesCache.java    From streamline with Apache License 2.0 4 votes vote down vote up
public RedisHashesCache(RedisConnection<K, V> redisConnection, K key) {
    this(redisConnection, key, null);
}
 
Example #10
Source File: RedisStringsCache.java    From streamline with Apache License 2.0 4 votes vote down vote up
public RedisStringsCache(RedisConnection<K, V> redisConnection, ExpiryPolicy expiryPolicy) {
    super(redisConnection, expiryPolicy);
}
 
Example #11
Source File: RedisStringsCache.java    From streamline with Apache License 2.0 4 votes vote down vote up
public RedisStringsCache(RedisConnection<K, V> redisConnection) {
    this(redisConnection, null);
}
 
Example #12
Source File: RedisAbstractCache.java    From streamline with Apache License 2.0 4 votes vote down vote up
public RedisAbstractCache(RedisConnection<K, V> redisConnection, ExpiryPolicy expiryPolicy) {
    super(expiryPolicy);
    this.redisConnection = redisConnection;
    setMaxSize();
}
 
Example #13
Source File: RedisAbstractCache.java    From streamline with Apache License 2.0 4 votes vote down vote up
public RedisAbstractCache(RedisConnection<K, V> redisConnection) {
    this(redisConnection, null);
}
 
Example #14
Source File: RedisCacheService.java    From streamline with Apache License 2.0 4 votes vote down vote up
public Factory<RedisConnection<K, V>> getConnFactory() {
    return connFactory;
}
 
Example #15
Source File: RedisCacheService.java    From streamline with Apache License 2.0 4 votes vote down vote up
public Builder(String id, TypeConfig.Cache cacheType, Factory<RedisConnection<K,V>> connFactory) {
    super(id, cacheType);
    this.connFactory = connFactory;
}
 
Example #16
Source File: RedisCacheTestMain.java    From registry with Apache License 2.0 4 votes vote down vote up
public static RedisConnection<String, String> getConnection1() {
    return connection1;
}
 
Example #17
Source File: RedisCacheTestMain.java    From registry with Apache License 2.0 4 votes vote down vote up
public static RedisConnection<String, String> getConnection() {
    return connection;
}
 
Example #18
Source File: RedisConnectionFactory.java    From registry with Apache License 2.0 4 votes vote down vote up
@Override
public RedisConnection<K, V> create() {
    return redisClient.connect(codec);
}
 
Example #19
Source File: RedisConnectionPoolFactory.java    From registry with Apache License 2.0 4 votes vote down vote up
public RedisConnection<K, V> create() {
    return redisClient.pool(codec, MAX_IDLE, MAX_ACTIVE).allocateConnection();
}
 
Example #20
Source File: RedisHashesCache.java    From registry with Apache License 2.0 4 votes vote down vote up
public RedisHashesCache(RedisConnection<K, V> redisConnection, K key, ExpiryPolicy expiryPolicy) {
    super(redisConnection, expiryPolicy);
    this.key = key;
}
 
Example #21
Source File: RedisHashesCache.java    From registry with Apache License 2.0 4 votes vote down vote up
public RedisHashesCache(RedisConnection<K, V> redisConnection, K key) {
    this(redisConnection, key, null);
}
 
Example #22
Source File: RedisStringsCache.java    From registry with Apache License 2.0 4 votes vote down vote up
public RedisStringsCache(RedisConnection<K, V> redisConnection, ExpiryPolicy expiryPolicy) {
    super(redisConnection, expiryPolicy);
}
 
Example #23
Source File: RedisStringsCache.java    From registry with Apache License 2.0 4 votes vote down vote up
public RedisStringsCache(RedisConnection<K, V> redisConnection) {
    this(redisConnection, null);
}
 
Example #24
Source File: RedisAbstractCache.java    From registry with Apache License 2.0 4 votes vote down vote up
public RedisAbstractCache(RedisConnection<K, V> redisConnection, ExpiryPolicy expiryPolicy) {
    super(expiryPolicy);
    this.redisConnection = redisConnection;
    setMaxSize();
}
 
Example #25
Source File: RedisAbstractCache.java    From registry with Apache License 2.0 4 votes vote down vote up
public RedisAbstractCache(RedisConnection<K, V> redisConnection) {
    this(redisConnection, null);
}
 
Example #26
Source File: RedisCacheService.java    From registry with Apache License 2.0 4 votes vote down vote up
public Factory<RedisConnection<K, V>> getConnFactory() {
    return connFactory;
}
 
Example #27
Source File: RedisCacheService.java    From registry with Apache License 2.0 4 votes vote down vote up
public Builder(String id, TypeConfig.Cache cacheType, Factory<RedisConnection<K,V>> connFactory) {
    super(id, cacheType);
    this.connFactory = connFactory;
}