Class: Twigg::Cache::Client

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/twigg-cache/cache/client.rb

Instance Method Summary collapse

Constructor Details

#initializeClient

Returns a new instance of Client.



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/twigg-cache/cache/client.rb', line 10

def initialize
  options = {
    compress:        true,
    expires_in:      Config.cache.expiry,
    value_max_bytes: Config.cache.value_max_bytes,
    namespace:       Config.cache.namespace,
  }.delete_if { |key, value| value.nil? }

  @client = Dalli::Client.new("#{Config.cache.host}:#{Config.cache.port}",
                              options)
end