Permalink
Browse files

updated parse and index to work with timestamped keys

  • Loading branch information...
dhgwilliam committed Nov 6, 2011
1 parent 76cde65 commit d9c31e3cb12853d617f7e08480a87a8393df27ee
Showing with 3 additions and 3 deletions.
  1. +1 −1 index.rb
  2. +2 −2 parse.rb
View
@@ -22,7 +22,7 @@
end
get '/:key' do
- @object = JSON.parse(redis.get("tag:google.com,2005:reader/item/#{params[:key]}"))
+ @object = JSON.parse(redis.get(redis.keys("*tag:google.com,2005:reader/item/#{params[:key]}")))
if @object.has_key?("content")
@item = @object.values_at("content")[0].values_at("content")[0]
elsif @object.has_key?("summary")
View
@@ -14,8 +14,8 @@
google_json = JSON.parse(google_string)
item_array = google_json.values_at("items")[0]
item_array.each do |item|
- item_id = item.values_at("id")[0]
+ item_id = "#{item.values_at("crawlTimeMsec").slice(0..9)[0]}:#{item.values_at("id")[0]}"
redis.set item_id, item.to_json
end
-redis_test = redis.get "tag:google.com,2005:reader/item/0e5c79d3a27b42d4"
+redis_test = redis.get redis.keys("*tag:google.com,2005:reader/item/0e5c79d3a27b42d4")[0]
puts JSON.parse(redis_test).values_at("id")

0 comments on commit d9c31e3

Please sign in to comment.