Class: Rimcache::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/rimcache/config.rb

Overview

Configuration for Rimcache

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



32
33
34
35
# File 'lib/rimcache/config.rb', line 32

def initialize
  @check_frequency = 4.seconds
  @expiry_cache_key = "rimcache_expiry"
end

Instance Attribute Details

#check_frequencyActiveSupport::Duration

The expiry cache will only be checked if it has not been in this much time. A stale cached value can keep being returned for up to this long after another process invalidates it. Defaults to 4 seconds

Returns:

  • (ActiveSupport::Duration)

    time in seconds



24
25
26
# File 'lib/rimcache/config.rb', line 24

def check_frequency
  @check_frequency
end

#expiry_cacheActiveSupport::Cache::Store

An instance of ActiveSupport::Cache::Store used to coordinate Rimcache expiry and invalidation across processes. If not set, defaults to Rails.cache.

Returns:

  • (ActiveSupport::Cache::Store)


12
13
14
# File 'lib/rimcache/config.rb', line 12

def expiry_cache
  @expiry_cache
end

#expiry_cache_keyString | Symbol

The cache key to use in expiry_cache. Defaults to “rimcache_expiry” but can be changed to avoid conflicts.

Returns:

  • (String | Symbol)


17
18
19
# File 'lib/rimcache/config.rb', line 17

def expiry_cache_key
  @expiry_cache_key
end

#refresh_intervalActiveSupport::Duration

If this is set, rimcached values will be refreshed after this much time even if they have not been explicitly expired. Default value is nil.

Returns:

  • (ActiveSupport::Duration)

    time in seconds



30
31
32
# File 'lib/rimcache/config.rb', line 30

def refresh_interval
  @refresh_interval
end