MEMCACHE_TABLE(5)
π MEMCACHE_TABLE(5) π
okay bestie, so this is the File Formats Manual page for memcache_table β it's literally called Postfix memcache client configuration and it's about to be your new obsession. no cap. π¦
β¨ NAME β¨
memcache_table β Postfix memcache client configuration, and yes that's the whole vibe π
β¨ SYNOPSIS β¨
postmap -q "string" memcache:/etc/postfix/filename
postmap -q - memcache:/etc/postfix/filename <inputfile
β¨ DESCRIPTION β¨
so the Postfix mail system uses optional tables for address rewriting or mail routing, right? normally those tables live in lmdb:, cdb:, hash:, or dbm: format. classic. πΈ
but plot twist: lookup tables can also be specified as memcache instances. to use memcache lookups you define a memcache source as a lookup table in main.cf, like:
virtual_alias_maps = memcache:/etc/postfix/memcache-aliases.cf
and the file /etc/postfix/memcache-aliases.cf has the same format as the Postfix main.cf file, and it specifies the parameters described below. it's giving config-inception π
the Postfix memcache client supports the lookup, update, delete and sequence (first/next) operations. heads up though β the sequence operation requires a backup database that supports the operation. no backup, no sequence, periodt.
π MEMCACHE MAIN PARAMETERS π
π memcache (default: inet:localhost:11211)
the memcache server (note: singular π) that Postfix will try to connect to.
- for a TCP server specify
inet:followed by a hostname or address,:, and a port name or number. - specify an IPv6 address inside
[]. - for a UNIX-domain server specify
unix:followed by the socket pathname.
examples, slay:
memcache = inet:memcache.example.com:11211
memcache = inet:127.0.0.1:11211
memcache = inet:[fc00:8d00:189::3]:11211
memcache = unix:/path/to/socket
NOTE: to access a UNIX-domain socket with theproxymap(8)server, the socket must be accessible by the unprivilegedpostfixuser. don't forget, bestie π«Ά
π backup (default: undefined)
an optional Postfix database that provides persistent backup for the memcache database. the Postfix memcache client will update the memcache database whenever it looks up or changes information in the persistent database. specify a Postfix "type:table" database. examples:
# Non-shared postscreen cache.
backup = btree:/var/lib/postfix/postscreen_cache_map
# Shared postscreen cache for processes on the same host.
backup = proxy:btree:/var/lib/postfix/postscreen_cache_map
access to remote proxymap servers is under development β so like, coming soon, not yet, don't come for me π₯
NOTE 1: when sharing a persistentpostscreen(8)orverify(8)cache, disable automatic cache cleanup (set*_cache_cleanup_interval = 0) except with one Postfix instance that will be responsible for cache cleanup.
NOTE 2: when multiple tables share the same memcache database, each table should use thekey_formatfeature (see below) to prepend its own unique string to the lookup key. otherwise, automaticpostscreen(8)orverify(8)cache cleanup may not work. one job each, okay? π
NOTE 3: when the backup database is accessed with"proxy:"lookups, the full backup database name (including the"proxy:"prefix) must be specified in the proxymap server'sproxy_read_mapsorproxy_write_mapssetting (depending on whether the access is read-only or read-write).
π flags (default: 0)
optional flags that should be stored along with a memcache update. the flags are ignored when looking up information. they're just there for the aesthetic β¨
π ttl (default: 3600)
the expiration time in seconds of memcache updates. tick tock β³
NOTE 1: when using a memcache table aspostscreen(8)orverify(8)cache without persistent backup, specify a zero*_cache_cleanup_intervalvalue with all Postfix instances that use the memcache, and specify the largestpostscreen(8)*_ttlvalue orverify(8)*_expire_timevalue as the memcache table'sttlvalue.
NOTE 2: according to memcache protocol documentation, a value greater than 30 days (2592000 seconds) specifies absolute UNIX time. smaller values are relative to the time of the update. so like, know which one you're doing or chaos ensues π
π MEMCACHE KEY PARAMETERS π
π key_digest (default: empty)
after processing the key_format setting, and before sending a request to the memcache server, run the key through the named message digest algorithm and convert the result to lowercase hexadecimal characters. this prevents a database access error when keys may exceed the memcache server's key length limit (usually, 250 bytes). specify the name of a message digest algorithm that is supported by OpenSSL, for example, sha256. π
this feature is available in Postfix 3.11 and later, and requires that Postfix is built with TLS support.
π key_format (default: %s)
format of the lookup and update keys that the Postfix memcache client sends to the memcache server. by default, these are the same as the lookup and update keys that the memcache client receives from Postfix applications. no glow-up needed, but the option is there π
NOTE 1: the key_format feature is not used for backup database requests.
NOTE 2: when multiple tables share the same memcache database, each table should prepend its own unique string to the lookup key. otherwise, automaticpostscreen(8)orverify(8)cache cleanup may not work.
examples, so cute:
key_format = aliases:%s
key_format = verify:%s
key_format = postscreen:%s
the key_format parameter supports the following '%' expansions:
%%β this is replaced by a literal'%'character.%sβ this is replaced by the memcache client input key.%uβ when the input key is an address of the form user@domain,%uis replaced by the SQL quoted local part of the address. otherwise,%uis replaced by the entire search string. if the localpart is empty, a lookup is silently suppressed and returns no results (an update is skipped with a warning).%dβ when the input key is an address of the form user@domain,%dis replaced by the domain part of the address. otherwise, a lookup is silently suppressed and returns no results (an update is skipped with a warning).%[SUD]β the upper-case equivalents of the above expansions behave in thekey_formatparameter identically to their lower-case counter-parts.%[1-9]β the patterns%1,%2, ...%9are replaced by the corresponding most significant component of the input key's domain. if the input key is user@mail.example.com, then%1iscom,%2isexampleand%3ismail. if the input key is unqualified or does not have enough domain components to satisfy all the specified patterns, a lookup is silently suppressed and returns no results (an update is skipped with a warning).
π domain (default: no domain list)
this feature can significantly reduce database server load. we love efficiency, we love a lazy queen π
specify a list of domain names, paths to files, or "type:table" databases. when specified, only fully qualified search keys with a non-empty localpart and a matching domain are eligible for lookup or update: bare 'user' lookups, bare domain lookups and "@domain" lookups are silently skipped (updates are skipped with a warning). example:
domain = example.com, hash:/etc/postfix/searchdomains
π¦ MEMCACHE ERROR CONTROLS π¦
data_size_limit(default:10240) β the maximal memcache reply data length in bytes.line_size_limit(default:1024) β the maximal memcache reply line length in bytes.max_try(default:2) β the number of times to try a memcache command before giving up. the memcache client does not retry a command when the memcache server accepts no connection. it said no and meant it πretry_pause(default:1) β the time in seconds before retrying a failed memcache command.timeout(default:2) β the time limit for sending a memcache command and for receiving a memcache reply.
π BUGS π
the Postfix memcache client cannot be used for security-sensitive tables such as alias_maps (these may contain "|command and "/file/name destinations), or virtual_uid_maps, virtual_gid_maps and virtual_mailbox_maps (these specify UNIX process privileges for "/file/name" destinations). in a typical deployment a memcache database is writable by any process that can talk to the memcache server; in contrast, security-sensitive tables must never be writable by the unprivileged Postfix user. this one's serious, bestie, do not play π¨
the Postfix memcache client requires additional configuration when used as postscreen(8) or verify(8) cache. for details see the backup and ttl parameter discussions in the MEMCACHE MAIN PARAMETERS section above.
πΈ SEE ALSO πΈ
postmap(1), Postfix lookup table managerpostconf(5), configuration parameters
π README FILES π
use "postconf readme_directory" or "postconf html_directory" to locate this information.
DATABASE_README, Postfix lookup table overviewMEMCACHE_README, Postfix memcache client guide
β LICENSE β
The Secure Mailer license must be distributed with this software.
π« HISTORY π«
Memcache support was introduced with Postfix version 2.9. ancient. iconic. a legend π«Ά
π AUTHOR(S) π
Wietse Venema
IBM T.J. Watson Research
P.O. Box 704
Yorktown Heights, NY 10598, USA
Wietse Venema
Google, Inc.
111 8th Avenue
New York, NY 10011, USA
and that's the whole page, bestie!! this was MEMCACHE_TABLE(5) straight out of the File Formats Manual β postmap it, cache it, keep it in the group chat πβ¨ mwah π
π¦
π¦ where this page comes from
- alpine 3.24: postfix-doc 3.11.7-r0 Β· IPL-1.0 EPL-2.0
- arch rolling: postfix 3.11.7-1 Β· EPL-2.0 OR IPL-1.0 AND BSD-4-Clause-UC
- nixos 26.05: postfix 3.11.7
- nixpkgs unstable: postfix 3.11.7
- ubuntu stonking: postfix 3.11.7-1ubuntu2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms