Method: Dalli::Protocol::Meta::RequestFormatter.meta_get

Defined in:
lib/dalli/protocol/meta/request_formatter.rb

.meta_get(key:, value: true, return_cas: false, ttl: nil, base64: false, quiet: false) ⇒ Object

Since these are string construction methods, we’re going to disable these Rubocop directives. We really can’t make this construction much simpler, and introducing an intermediate object seems like overkill.

rubocop:disable Metrics/CyclomaticComplexity rubocop:disable Metrics/MethodLength rubocop:disable Metrics/ParameterLists rubocop:disable Metrics/PerceivedComplexity



19
20
21
22
23
24
25
26
27
# File 'lib/dalli/protocol/meta/request_formatter.rb', line 19

def self.meta_get(key:, value: true, return_cas: false, ttl: nil, base64: false, quiet: false)
  cmd = "mg #{key}"
  cmd << ' v f' if value
  cmd << ' c' if return_cas
  cmd << ' b' if base64
  cmd << " T#{ttl}" if ttl
  cmd << ' k q s' if quiet # Return the key in the response if quiet
  cmd + TERMINATOR
end