Class: Textus::Domain::Freshness::Policy
- Inherits:
-
Data
- Object
- Data
- Textus::Domain::Freshness::Policy
- Defined in:
- lib/textus/domain/freshness/policy.rb
Instance Attribute Summary collapse
-
#on_stale ⇒ Object
readonly
Returns the value of attribute on_stale.
-
#sync_budget_ms ⇒ Object
readonly
Returns the value of attribute sync_budget_ms.
-
#ttl_seconds ⇒ Object
readonly
Returns the value of attribute ttl_seconds.
Instance Method Summary collapse
Instance Attribute Details
#on_stale ⇒ Object (readonly)
Returns the value of attribute on_stale
4 5 6 |
# File 'lib/textus/domain/freshness/policy.rb', line 4 def on_stale @on_stale end |
#sync_budget_ms ⇒ Object (readonly)
Returns the value of attribute sync_budget_ms
4 5 6 |
# File 'lib/textus/domain/freshness/policy.rb', line 4 def sync_budget_ms @sync_budget_ms end |
#ttl_seconds ⇒ Object (readonly)
Returns the value of attribute ttl_seconds
4 5 6 |
# File 'lib/textus/domain/freshness/policy.rb', line 4 def ttl_seconds @ttl_seconds end |
Instance Method Details
#decide(verdict) ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/textus/domain/freshness/policy.rb', line 5 def decide(verdict) return Action::Return.new if verdict.fresh? case on_stale when :warn then Action::Return.new when :sync then Action::RefreshSync.new when :timed_sync then Action::RefreshTimed.new(budget_ms: sync_budget_ms) else Action::Return.new end end |