contributte / redis

:floppy_disk: Redis (predis) for Nette Framework (@nette)

Home Page:https://contributte.org/packages/contributte/redis.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Write/read inconsistence

mrceperka opened this issue Β· comments

Hello πŸ‘‹,
I've got a problem..

$x = ['foo' => 'bar'];
$cache->write('x', $x);
$cache->read('x') === $x; // false, because $cache->read will return \stdClass
  • Write uses json_encode, read uses json_decode.
  • Found that thanks to nextras/orm, CachedPlatform::getColumns, which failed because \stdClass was obtained from storage insted of and array.

Why are data encoded and decoded?
Could it be just passed to redis (so it would be handler by redis serialization thing...)

Thanks πŸ™