Class: PairingMatrix::CommitCache
- Inherits:
-
Object
- Object
- PairingMatrix::CommitCache
- Defined in:
- lib/pairing_matrix/cache/commit_cache.rb
Instance Method Summary collapse
- #get(date) ⇒ Object
-
#initialize ⇒ CommitCache
constructor
A new instance of CommitCache.
- #put(date, response) ⇒ Object
Constructor Details
#initialize ⇒ CommitCache
Returns a new instance of CommitCache.
13 14 15 16 |
# File 'lib/pairing_matrix/cache/commit_cache.rb', line 13 def initialize @cache = {} @timestamp = Date.today end |
Instance Method Details
#get(date) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# 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) ⇒ Object
18 19 20 |
# File 'lib/pairing_matrix/cache/commit_cache.rb', line 18 def put(date, response) @cache[date] = response end |