Created
December 29, 2011 16:41
-
-
Save matiskay/1534900 to your computer and use it in GitHub Desktop.
Redis and json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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