Sha256: 34374c254d0cd3fb114ff880760021086af5e5df12f7bbf321cc747e731bac37
Contents?: true
Size: 489 Bytes
Versions: 1
Compression:
Stored size: 489 Bytes
Contents
module Sevendigital class ApiOperatorCached < ApiOperator def initialize(client, cache) @cache = cache super(client) end def call_api(api_request) uri = create_request_uri(api_request) api_response = @cache.get(uri.to_s) #puts "got from cache #{uri}" if api_response if (!api_response) then #puts "calling #{uri}" api_response = make_http_request_and_digest(uri) @cache.set(uri.to_s, api_response) end api_response end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
7digital-0.0.1 | lib/sevendigital/api_operator_cached.rb |