Class: RedBlocks::Config

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client_proc:, cache_client: false, key_namespace:, intermediate_set_lifetime:, blank_id:, infinity: Float::INFINITY) ⇒ Config

Returns a new instance of Config.



21
22
23
24
25
26
27
28
# File 'lib/red_blocks/config.rb', line 21

def initialize(client_proc:, cache_client: false, key_namespace:, intermediate_set_lifetime:, blank_id:, infinity: Float::INFINITY)
  @key_namespace = key_namespace
  @intermediate_set_lifetime = intermediate_set_lifetime
  @blank_id = blank_id
  @client_proc = client_proc
  @cache_client = cache_client
  @infinity = infinity
end

Instance Attribute Details

#blank_idObject (readonly)

Used to represent a “blank” set. So you cannot use 0 in real id.



16
17
18
# File 'lib/red_blocks/config.rb', line 16

def blank_id
  @blank_id
end

#cache_clientObject (readonly)

Returns the value of attribute cache_client.



5
6
7
# File 'lib/red_blocks/config.rb', line 5

def cache_client
  @cache_client
end

#client_procObject (readonly)

Proc which returns Redis client.



4
5
6
# File 'lib/red_blocks/config.rb', line 4

def client_proc
  @client_proc
end

#infinityObject (readonly)

For test. See spec_helper.rb



19
20
21
# File 'lib/red_blocks/config.rb', line 19

def infinity
  @infinity
end

#intermediate_set_lifetimeObject (readonly)

It is guaranteed that all set exist in 30 seconds at least. This means that all transaction must be completed in the time.



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

def intermediate_set_lifetime
  @intermediate_set_lifetime
end

#key_namespaceObject (readonly)

The key prefix for Redis.



8
9
10
# File 'lib/red_blocks/config.rb', line 8

def key_namespace
  @key_namespace
end