samedi 8 août 2015

getting unanted charcaters in cache value using dalli

I am trying to read the cache value set in Rails.cache , i am working on rails 3.1 and using dalli.

When i execute this block i am getting some unwanted characters in response

Here is the code block

@total_count = Rails.cache.fetch(count_key){connection.select_rows("select FOUND_ROWS()").first.first.to_s}

and the output i am getting is

���Uc��T�022b�bsu���#

When i try to use insepect on total_count i get the below output

"\x1F\x8B\b\x00\xAC\xF9\xC5U\x00\x03c\xE1\xF0T\xE2022b\xB3bsu\x03\x00\x9A\x84\xF8#\r\x00\x00\x00"

i am expecting a interger value like 128 or 222. Can anyone please suggest what could be going wrong here, Thanks.

Aucun commentaire:

Enregistrer un commentaire