com.lambdaworks.redis.codec
Class RedisCodec<K,V>

java.lang.Object
  extended by com.lambdaworks.redis.codec.RedisCodec<K,V>
Type Parameters:
K - Key type.
V - Value type.
Direct Known Subclasses:
Utf8StringCodec

public abstract class RedisCodec<K,V>
extends Object

A RedisCodec encodes keys and values sent to redis, and decodes keys and values in the command output. The encode methods will be called by multiple threads and must be thread-safe, however the decode methods will only be called by one thread.

Author:
Will Glozer

Constructor Summary
RedisCodec()
           
 
Method Summary
abstract  K decodeKey(ByteBuffer bytes)
          Decode the key output by redis.
abstract  V decodeValue(ByteBuffer bytes)
          Decode the value output by redis.
abstract  byte[] encodeKey(K key)
          Encode the key for output to redis.
abstract  byte[] encodeValue(V value)
          Encode the value for output to redis.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RedisCodec

public RedisCodec()
Method Detail

decodeKey

public abstract K decodeKey(ByteBuffer bytes)
Decode the key output by redis.

Parameters:
bytes - Raw bytes of the key.
Returns:
The decoded key.

decodeValue

public abstract V decodeValue(ByteBuffer bytes)
Decode the value output by redis.

Parameters:
bytes - Raw bytes of the value.
Returns:
The decoded value.

encodeKey

public abstract byte[] encodeKey(K key)
Encode the key for output to redis.

Parameters:
key - Key.
Returns:
The encoded key.

encodeValue

public abstract byte[] encodeValue(V value)
Encode the value for output to redis.

Parameters:
value - Value.
Returns:
The encoded value.


Copyright © 2013. All Rights Reserved.