class PairingMatrix::CommitCache

Public Class Methods

new() click to toggle source
# File lib/pairing_matrix/cache/commit_cache.rb, line 13
def initialize
  @cache = {}
  @timestamp = Date.today
end

Public Instance Methods

get(date) click to toggle source
# File lib/pairing_matrix/cache/commit_cache.rb, line 22
def get(date)
  return nil unless PairingMatrix.cache_enabled

  if Date.today == @timestamp
    @cache[date]
  else
    invalidate_cache
    nil
  end
end
put(date, response) click to toggle source
# File lib/pairing_matrix/cache/commit_cache.rb, line 18
def put(date, response)
  @cache[date] = response
end

Private Instance Methods

invalidate_cache() click to toggle source
# File lib/pairing_matrix/cache/commit_cache.rb, line 34
def invalidate_cache
  @cache = {}
end