mcarleio    /
                    sciurus-cache-redis
                
                            | 1 | package io.mcarle.sciurus.cache.redis;  | 
            ||
| 
                                                                                                    
                         0 ignored issues 
                            –
                            show
                                    Code Smell
    
    
    
        introduced 
                            by  
        
   Loading history...
                 | 
                |||
| 2 | |||
| 3 | import io.lettuce.core.codec.RedisCodec;  | 
            ||
| 4 | |||
| 5 | import java.nio.ByteBuffer;  | 
            ||
| 6 | import java.nio.charset.StandardCharsets;  | 
            ||
| 7 | |||
| 8 | 1 | public class RedisJsonCodec implements RedisCodec<String, RedisData> { | 
            |
| 
                                                                                                    
                         0 ignored issues 
                            –
                            show
                         | 
                |||
| 9 | |||
| 10 | @Override  | 
            ||
| 11 |     public String decodeKey(final ByteBuffer bytes) { | 
            ||
| 
                                                                                                                                                        
                         0 ignored issues 
                            –
                            show
                         | 
                |||
| 12 | 1 | return StandardCharsets.UTF_8.decode(bytes).toString();  | 
            |
| 
                                                                                                    
                         0 ignored issues 
                            –
                            show
                         | 
                |||
| 13 | }  | 
            ||
| 14 | |||
| 15 | @Override  | 
            ||
| 16 |     public RedisData decodeValue(final ByteBuffer bytes) { | 
            ||
| 
                                                                                                    
                         0 ignored issues 
                            –
                            show
                         | 
                |||
| 17 | 1 | return RedisData.fromByteBuffer(bytes);  | 
            |
| 
                                                                                                    
                         0 ignored issues 
                            –
                            show
                         | 
                |||
| 18 | }  | 
            ||
| 19 | |||
| 20 | @Override  | 
            ||
| 21 |     public ByteBuffer encodeKey(final String key) { | 
            ||
| 
                                                                                                    
                         0 ignored issues 
                            –
                            show
                         | 
                |||
| 22 | 1 | return StandardCharsets.UTF_8.encode(key);  | 
            |
| 
                                                                                                    
                         0 ignored issues 
                            –
                            show
                         | 
                |||
| 23 | }  | 
            ||
| 24 | |||
| 25 | @Override  | 
            ||
| 26 |     public ByteBuffer encodeValue(final RedisData value) { | 
            ||
| 
                                                                                                    
                         0 ignored issues 
                            –
                            show
                         | 
                |||
| 27 | 1 | return RedisData.toByteBuffer(value);  | 
            |
| 
                                                                                                    
                         0 ignored issues 
                            –
                            show
                         | 
                |||
| 28 | }  | 
            ||
| 29 | }  | 
            ||
| 30 |