Class: BusinessFlow::Cacheable::ClassMethods::CacheOptions

Inherits:
Struct
  • Object
show all
Defined in:
lib/business_flow/cacheable.rb

Overview

Responsible for converting our DSL options into cache store options

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#ttlObject

Returns the value of attribute ttl

Returns:

  • (Object)

    the current value of ttl



19
20
21
# File 'lib/business_flow/cacheable.rb', line 19

def ttl
  @ttl
end

Instance Method Details

#to_store_options(flow) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/business_flow/cacheable.rb', line 20

def to_store_options(flow)
  # compact is not available in Ruby <2.4 or ActiveSupport < 4, so
  # we can't use it here.
  options = {}
  options[:expires_in] = ttl.call(flow, nil) if ttl
  options
end