<%-
result = []
if @verbosity
  result << '-' + @verbosity.to_s
end
if @lock_memory
  result << '-k'
end
if @real_listen
  result << '-l ' + @real_listen.join(',')
end
if @udp_port
  result << '-U ' + @udp_port.to_s
end
if @unix_socket
  result << '-s ' + @unix_socket.to_s + ' -a ' + @unix_socket_mask.to_s
end
if @max_item_size
  result << '-I ' + @max_item_size.to_s
end
if @min_item_size
  result << '-n ' + @min_item_size.to_s
end
if @factor
  result << '-f ' + @factor.to_s
end
if @extended_opts
  result << '-o ' + @extended_opts.join(',')
end
if @disable_cachedump
  result << '-X'
end
result << '-t ' + @processorcount.to_s
if @use_tls
  result << '-Z'
  result << '-o ssl_chain_cert=' + @tls_cert_chain
  result << '-o ssl_key=' + @tls_key
  if @tls_ca_cert
    result << '-o ssl_ca_cert=' + @tls_ca_cert
  end
  result << '-o ssl_verify_mode=' + @tls_verify_mode.to_s
end
if @use_sasl
  result << '-S'
end

if !@logstdout
  # log to syslog via logger
  if @syslog && !@logfile
    result << '2>&1 |/bin/logger &'
  # log to log file
  elsif @logfile && !@syslog
    result << '>> ' + @logfile + ' 2>&1'
  end
end
-%>
<%- if scope['osfamily'] != 'Suse' -%>
PORT="<%= @tcp_port %>"
USER="<%= @user %>"
MAXCONN="<%= @max_connections %>"
CACHESIZE="<%= scope.call_function('memcached::max_memory', [@max_memory]) %>"
OPTIONS="<%= result.join(' ') %>"
<%- else -%>
MEMCACHED_PARAMS="<%= result.join(' ') %>"

## Path:        Network/WWW/Memcached
## Description: username memcached should run as
## Type:        string
## Default:     "memcached"
## Config:      memcached
#
# username memcached should run as
#
MEMCACHED_USER="<%= @user %>"

## Path:        Network/WWW/Memcached
## Description: group memcached should be run as
## Type:        string
## Default:     "memcached"
## Config:      memcached
#
# group memcached should be run as
#
MEMCACHED_GROUP="<%= @user %>"
<%- end -%>
