RedissonCodec interface introduced
parent
9ce68282ea
commit
c860bb921d
@ -0,0 +1,37 @@
|
||||
package org.redisson.codec;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import com.lambdaworks.redis.codec.RedisCodec;
|
||||
|
||||
public class RedisCodecWrapper extends RedisCodec<Object, Object> {
|
||||
|
||||
private final RedissonCodec redissonCodec;
|
||||
|
||||
public RedisCodecWrapper(RedissonCodec redissonCodec) {
|
||||
this.redissonCodec = redissonCodec;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object decodeKey(ByteBuffer bytes) {
|
||||
return redissonCodec.decodeKey(bytes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object decodeValue(ByteBuffer bytes) {
|
||||
return redissonCodec.decodeValue(bytes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] encodeKey(Object key) {
|
||||
return redissonCodec.encodeKey(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] encodeValue(Object value) {
|
||||
return redissonCodec.encodeValue(value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package org.redisson.codec;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
public interface RedissonCodec {
|
||||
|
||||
/**
|
||||
* Decode the key output by redis.
|
||||
*
|
||||
* @param bytes Raw bytes of the key.
|
||||
*
|
||||
* @return The decoded key.
|
||||
*/
|
||||
public abstract Object decodeKey(ByteBuffer bytes);
|
||||
|
||||
/**
|
||||
* Decode the value output by redis.
|
||||
*
|
||||
* @param bytes Raw bytes of the value.
|
||||
*
|
||||
* @return The decoded value.
|
||||
*/
|
||||
public abstract Object decodeValue(ByteBuffer bytes);
|
||||
|
||||
/**
|
||||
* Encode the key for output to redis.
|
||||
*
|
||||
* @param key Key.
|
||||
*
|
||||
* @return The encoded key.
|
||||
*/
|
||||
public abstract byte[] encodeKey(Object key);
|
||||
|
||||
/**
|
||||
* Encode the value for output to redis.
|
||||
*
|
||||
* @param value Value.
|
||||
*
|
||||
* @return The encoded value.
|
||||
*/
|
||||
public abstract byte[] encodeValue(Object value);
|
||||
|
||||
}
|
Loading…
Reference in New Issue