1

I have problems with key-value encryption in redis-cli.

My Settings are as in tutorials

service.yml

app.my_custom_redis_provider:
    class: \Predis\Client
    factory: [ 'Symfony\Component\Cache\Adapter\RedisAdapter', 'createConnection' ]
    arguments:
       - '%redis_url%'

cache.yml

framework:
    cache:
        pools:
            cache.my_redis:
                adapter: cache.adapter.redis
                provider: app.my_custom_redis_provider

I am using Elasticache Redis and creating the key in Symfony PHP like this

/**
* @Route("/predis/client", name="test_redis_client")
*/
 public function testRedisClient(CacheInterface $cacheMyRedis)
 {
   $result = $cacheMyRedis->get("test1", function(ItemInterface $item) {
                $item->expiresAfter(20);
                return "hello world";
            });
   return new JsonResponse(["result", $result]);
 }

in my terminal, I am getting the below encrypted key.

> KEYS *  
1) "5pVu-McBP9:test1"

It has appended a unique hash to the key.

If I get the value:

> GET 5pVu-McBP9:test1
"\x00\x00\x00\x02\x17\x01\xa9\x14\x01\x11\x06D\xcf\x8d\x01@\x1d\x11\rhello world"

Again the "hello world" has another encrypted pre-fix.

So it's hard to track the redis-cli. I know, redis-cli is designed so that other people can't see your values for safety. Is there a way to avoid that or is that a Symfony thing?

Nothing wrong with the code, I can still get the values through code with just "test1". My question is only about redis-cli so that I can insert "test1" as the key and "hello world" as the value in redis-cli?

mehmetsen80
  • 727
  • 1
  • 8
  • 25

0 Answers0