# File managed by puppet

# Run memcached as a daemon.
-d

<% if @pidfile -%>
# pidfile
-P <%= @pidfile %>
<% end -%>

# Log memcached's output
logfile <%= @logfile -%>

<% if @verbosity -%>
# Verbosity
-<%= @verbosity %>
<% end -%>

# Use <num> MB memory max to use for object storage.
-m <%= scope.call_function('memcached::max_memory', [@max_memory]) %>

<% if @lock_memory -%>
# Lock down all paged memory.  There is a limit on how much memory you may lock.
-k
<% end -%>

<% if @use_sasl -%>
# Start with SASL support
-S
<% end -%>

<% if @use_tls -%>
# Start with TLS support
-Z
-o ssl_chain_cert=<%= @tls_cert_chain %>
-o ssl_key=<%= @tls_key %>
<% if @tls_ca_cert -%>
-o ssl_ca_cert=<%= @tls_ca_cert %>
<% end -%>
-o ssl_verify_mode=<%= @tls_verify_mode %>
<% end -%>

<% if @unix_socket -%>
# UNIX socket path to listen on
-s <%= @unix_socket %>

# UNIX socket access mask
-a <%= @unix_socket_mask %>
<% else -%>

<% if @real_listen -%>
# interfaces to listen on
-l <%= @real_listen.join(',') %>
<% end -%>

# TCP port to listen on
-p <%= @tcp_port %>

# UDP port to listen on
-U <%= @udp_port %>
<% end -%>

# Run daemon as user
-u <%= @user %>

<% if @large_mem_pages -%>
# Try to use large memory pages (if available)
-L
<% end -%>

# Limit the number of simultaneous incoming connections.
-c <%= @max_connections %>

# Number of threads to use to process incoming requests.
-t <%= @processorcount %>

<% if @max_item_size -%>
# Override  the  default size of each slab page
-I <%= @max_item_size %>
<% end -%>

<% if @min_item_size -%>
# Override  the  default size of each slab page
-n <%= @min_item_size %>
<% end -%>

<% if @factor -%>
# Override the default factor
-f <%= @factor %>
<% end -%>

<% if @auto_removal -%>
# Disable automatic removal of items from the cache when out of memory
-M
<% end -%>

<% if @extended_opts -%>
-o <%= @extended_opts.join(',') -%>
<% end -%>

<% if @disable_cachedump -%>
-X
<% end -%>
