Skip to content

Commit

Permalink
Merge pull request #3 from pikesley/redis
Browse files Browse the repository at this point in the history
Maybe this is cromulent
  • Loading branch information
Sam Pikesley committed Dec 31, 2015
2 parents 7498279 + ab65e52 commit 261f9fc
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/dashboard/fetcher.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module Dashboard
class Fetcher
@@redis = Redis.new

def self.headers
{
'Accept' => 'application/vnd.github.v3+json',
Expand All @@ -15,15 +17,14 @@ def self.query
end

def self.get url
redis = Redis.new
if redis.get url
return Marshal.load(redis.get url)
if @@redis.get url
return Marshal.load(@@redis.get url)
end

h = HTTParty.get url, headers: headers, query: query
redis.set url, Marshal.dump(h.body)
redis.expire url, 3600
return Marshal.load(redis.get url)
@@redis.set url, Marshal.dump(h.body)
@@redis.expire url, 3600
return Marshal.load(@@redis.get url)
end

def self.extract_repo url
Expand Down

0 comments on commit 261f9fc

Please sign in to comment.