0

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.

Anatoly
  • 15,298
  • 5
  • 53
  • 77
opensource-developer
  • 2,826
  • 4
  • 38
  • 88
  • *FOUND_ROWS()* is used to return **previous** *SELECT* row count number, what is the previous SELECT in your case? – Anatoly Aug 08 '15 at 17:08
  • Whats the result of executing `connection.select_rows("select FOUND_ROWS()").first.first.to_s` outside the Rails.cache block? – bigsolom Aug 08 '15 at 19:00

1 Answers1

0

I figured out the issue, i restarted the memcache server and that reolved my issue, Thanks.

opensource-developer
  • 2,826
  • 4
  • 38
  • 88