kr.pe.kwonnam.hibernate4memcached.spymemcached.KryoTranscoder Maven / Gradle / Ivy
package kr.pe.kwonnam.hibernate4memcached.spymemcached;
import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.io.Input;
import com.esotericsoftware.kryo.io.Output;
import com.esotericsoftware.kryo.serializers.CompatibleFieldSerializer;
import de.javakaffee.kryoserializers.KryoReflectionFactorySupport;
import kr.pe.kwonnam.hibernate4memcached.util.IntToBytesUtils;
import kr.pe.kwonnam.hibernate4memcached.util.Lz4CompressUtils;
import kr.pe.kwonnam.hibernate4memcached.util.OverridableReadOnlyProperties;
import net.spy.memcached.CachedData;
import org.apache.commons.lang3.ArrayUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
/**
* Default transcoder for {@link SpyMemcachedAdapter}.
*
* This transcoder uses Kryo Serializer and compress data with Lz4 when data size is greater than compression
* threashold.
*
* @author KwonNam Son ([email protected])
*/
public class KryoTranscoder implements InitializableTranscoder