Class: ThreeScale::Backend::Period::Cache
- Inherits:
-
Object
- Object
- ThreeScale::Backend::Period::Cache
- Defined in:
- lib/3scale/backend/period/cache.rb
Overview
A simple last-used instance cache
This is expected to be especially effective for us since most of the time what we look for is start/finish and the exact timestamp does not matter.
Class Method Summary collapse
Class Method Details
.get(granularity, start) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/3scale/backend/period/cache.rb', line 14 def get(granularity, start) cached = @cache[granularity] if cached && cached.start == start cached end end |
.set(granularity, obj) ⇒ Object
21 22 23 |
# File 'lib/3scale/backend/period/cache.rb', line 21 def set(granularity, obj) @cache[granularity] = obj end |