redis.clients.jedis.MultiKeyBinaryCommands Java Examples

The following examples show how to use redis.clients.jedis.MultiKeyBinaryCommands. 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: RedisGenericCache.java    From J2Cache with Apache License 2.0 6 votes vote down vote up
@Override
public void setBytes(Map<String,byte[]> bytes) {
    try {
        BinaryJedisCommands cmd = client.get();
        if(cmd instanceof MultiKeyBinaryCommands) {
            byte[][] data = new byte[bytes.size() * 2][];
            int idx = 0;
            for(String key : bytes.keySet()){
                data[idx++] = _key(key);
                data[idx++] = bytes.get(key);
            }
            ((MultiKeyBinaryCommands)cmd).mset(data);
        }
        else
            bytes.forEach((k,v) -> setBytes(k, v));
    } finally {
        client.release();
    }
}
 
Example #2
Source File: RedisGenericCache.java    From J2Cache with Apache License 2.0 5 votes vote down vote up
@Override
public List<byte[]> getBytes(Collection<String> keys) {
    try {
        BinaryJedisCommands cmd = client.get();
        if(cmd instanceof MultiKeyBinaryCommands) {
            byte[][] bytes = keys.stream().map(k -> _key(k)).toArray(byte[][]::new);
            return ((MultiKeyBinaryCommands)cmd).mget(bytes);
        }
        return keys.stream().map(k -> getBytes(k)).collect(Collectors.toList());
    } finally {
        client.release();
    }
}
 
Example #3
Source File: JedisProviderFactory.java    From azeroth with Apache License 2.0 4 votes vote down vote up
public static MultiKeyBinaryCommands getMultiKeyBinaryCommands(String groupName) {
    return (MultiKeyBinaryCommands) getJedisProvider(groupName).get();
}
 
Example #4
Source File: JedisProviderFactory.java    From jeesuite-libs with Apache License 2.0 4 votes vote down vote up
public static MultiKeyBinaryCommands getMultiKeyBinaryCommands(String groupName) {
	return (MultiKeyBinaryCommands) getJedisProvider(groupName).get();
}