{"action":"closed","issue":{"url":"https://api.github.com/repos/redis/redis-rb/issues/645","repository_url":"https://api.github.com/repos/redis/redis-rb","labels_url":"https://api.github.com/repos/redis/redis-rb/issues/645/labels{/name}","comments_url":"https://api.github.com/repos/redis/redis-rb/issues/645/comments","events_url":"https://api.github.com/repos/redis/redis-rb/issues/645/events","html_url":"https://github.com/redis/redis-rb/issues/645","id":186293936,"number":645,"title":"how is a best method to cache a image ?","user":{"login":"luizamboni","id":2022359,"avatar_url":"https://avatars.githubusercontent.com/u/2022359?v=3","gravatar_id":"","url":"https://api.github.com/users/luizamboni","html_url":"https://github.com/luizamboni","followers_url":"https://api.github.com/users/luizamboni/followers","following_url":"https://api.github.com/users/luizamboni/following{/other_user}","gists_url":"https://api.github.com/users/luizamboni/gists{/gist_id}","starred_url":"https://api.github.com/users/luizamboni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luizamboni/subscriptions","organizations_url":"https://api.github.com/users/luizamboni/orgs","repos_url":"https://api.github.com/users/luizamboni/repos","events_url":"https://api.github.com/users/luizamboni/events{/privacy}","received_events_url":"https://api.github.com/users/luizamboni/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-10-31T14:15:20Z","updated_at":"2016-10-31T14:34:20Z","closed_at":"2016-10-31T14:34:20Z","body":"i m usin the follow code in a rails action, but some times, none is returned\r\n\r\n```ruby\r\n    size = params[:size] || :original\r\n    key = \"images::user::#{size}::#{params[:user_id]}::\"\r\n    data = RedisClient.get key \r\n    if data\r\n      logger.info \"cache avatar\"\r\n      send_data data, status: 304\r\n    else\r\n      logger.info \"no cache avatar\"\r\n      user = User.find(params[:user_id])\r\n      url = (Rails.env.production?)? user.avatar.url(size) :  user.avatar.path(size)\r\n      data = open(url).read\r\n      content_type = user.avatar.content_type\r\n      Thread.new { RedisClient.setex(\"#{key}\", PICTURES_CH, data) }.join\r\n      send_data data\r\n    end\r\n```"}}
{"actor":{"display_login":"badboy"}}