Search in sources :

Example 1 with StatefulRedisClusterConnection

use of com.lambdaworks.redis.cluster.api.StatefulRedisClusterConnection in project jetcache by alibaba.

the class LutteceConnectionManager method asyncCommands.

public Object asyncCommands(AbstractRedisClient redisClient) {
    connection(redisClient);
    LutteceObjects lo = getLutteceObjectsFromMap(redisClient);
    if (lo.asyncCommands == null) {
        if (lo.connection instanceof StatefulRedisConnection) {
            lo.asyncCommands = ((StatefulRedisConnection) lo.connection).async();
        } else if (lo.connection instanceof StatefulRedisClusterConnection) {
            lo.asyncCommands = ((StatefulRedisClusterConnection) lo.connection).async();
        } else {
            throw new CacheConfigException("type " + lo.connection.getClass() + " is not supported");
        }
    }
    return lo.asyncCommands;
}
Also used : CacheConfigException(com.alicp.jetcache.CacheConfigException) StatefulRedisClusterConnection(com.lambdaworks.redis.cluster.api.StatefulRedisClusterConnection) StatefulRedisConnection(com.lambdaworks.redis.api.StatefulRedisConnection)

Example 2 with StatefulRedisClusterConnection

use of com.lambdaworks.redis.cluster.api.StatefulRedisClusterConnection in project jetcache by alibaba.

the class LutteceConnectionManager method commands.

public Object commands(AbstractRedisClient redisClient) {
    connection(redisClient);
    LutteceObjects lo = getLutteceObjectsFromMap(redisClient);
    if (lo.commands == null) {
        if (lo.connection instanceof StatefulRedisConnection) {
            lo.commands = ((StatefulRedisConnection) lo.connection).sync();
        } else if (lo.connection instanceof StatefulRedisClusterConnection) {
            lo.commands = ((StatefulRedisClusterConnection) lo.connection).sync();
        } else {
            throw new CacheConfigException("type " + lo.connection.getClass() + " is not supported");
        }
    }
    return lo.commands;
}
Also used : CacheConfigException(com.alicp.jetcache.CacheConfigException) StatefulRedisClusterConnection(com.lambdaworks.redis.cluster.api.StatefulRedisClusterConnection) StatefulRedisConnection(com.lambdaworks.redis.api.StatefulRedisConnection)

Example 3 with StatefulRedisClusterConnection

use of com.lambdaworks.redis.cluster.api.StatefulRedisClusterConnection in project jetcache by alibaba.

the class LutteceConnectionManager method reactiveCommands.

public Object reactiveCommands(AbstractRedisClient redisClient) {
    connection(redisClient);
    LutteceObjects lo = getLutteceObjectsFromMap(redisClient);
    if (lo.reactiveCommands == null) {
        if (lo.connection instanceof StatefulRedisConnection) {
            lo.reactiveCommands = ((StatefulRedisConnection) lo.connection).reactive();
        } else if (lo.connection instanceof StatefulRedisClusterConnection) {
            lo.reactiveCommands = ((StatefulRedisClusterConnection) lo.connection).reactive();
        } else {
            throw new CacheConfigException("type " + lo.connection.getClass() + " is not supported");
        }
    }
    return lo.reactiveCommands;
}
Also used : CacheConfigException(com.alicp.jetcache.CacheConfigException) StatefulRedisClusterConnection(com.lambdaworks.redis.cluster.api.StatefulRedisClusterConnection) StatefulRedisConnection(com.lambdaworks.redis.api.StatefulRedisConnection)

Aggregations

CacheConfigException (com.alicp.jetcache.CacheConfigException)3 StatefulRedisConnection (com.lambdaworks.redis.api.StatefulRedisConnection)3 StatefulRedisClusterConnection (com.lambdaworks.redis.cluster.api.StatefulRedisClusterConnection)3