All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zalando.fahrschein.redis.CursorKeyRedisSerializer Maven / Gradle / Ivy

There is a newer version: 0.21.1
Show newest version
package org.zalando.fahrschein.redis;

import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.data.redis.serializer.SerializationException;

class CursorKeyRedisSerializer implements RedisSerializer {

    public static final Codec CODEC = new Codec();

    @Override
    public byte[] serialize(final RedisCursorKey cursorKey) throws SerializationException {
        return CODEC.serialize(cursorKey.getConsumerName(), cursorKey.getEventType(), cursorKey.getPartition());
    }

    @Override
    public RedisCursorKey deserialize(final byte[] bytes) throws SerializationException {
        final String[] values = CODEC.deserialize(bytes);

        if (values == null) {
            return null;
        }

        return new RedisCursorKey(values[0], values[1], values[2]);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy