Skip to content

Instantly share code, notes, and snippets.

@matiskay
Created December 29, 2011 16:41
Show Gist options
  • Save matiskay/1534900 to your computer and use it in GitHub Desktop.
Save matiskay/1534900 to your computer and use it in GitHub Desktop.
Redis and json
require 'redis'
require 'json'
def get_redis_json()
FIELDS = ['title', 'desc', 'lat', 'lon']
json = {}
FIELDS.each do |field|
json[field] = redis.get("point:#{id}:#{field}")
end
return json.to_json
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment