2016-03-18 19 views

cevap

0

Nereye gittiğinize göre değişir. Yalnızca kendi uygulamanız için kullanmayı planlıyorsanız, JedisConnectionFactory numaralı telefondan bir JedisConnection edinebilir ve komutları çağırmak için temeldeki Jedis örneğini kullanabilirsiniz.

JedisConnectionFactory factory = … 

// assuming you're using Redis Standalone or Redis Sentinel 
RedisConnection connection = factory.getConnection(); 
try { 
    if (connection instanceof JedisConnection) { 
     Jedis jedis = ((JedisConnection) connection).getNativeConnection(); 
     List<String> strings = jedis.pubsubChannels("…"); 
    } 
} finally { 
    connection.close(); 
} 

bu sadece Redis Bağımsız/Redis Sentinel ile değil pubsubChannels göstermiyor JedisCluster olarak Redis Kümesi ile çalışır unutmayınız.

İlgili konular