Previously, memcached keys in MediaWiki were typically constructed like this:
$key = "$wgDBname:user:id:$id";
This does not work when you have more than one wiki in the same database,
which is possible with table prefixes. I have now introduced a memcached key
construction function called wfMemcKey(). It is used like this:
$key = wfMemcKey( 'user', 'id', $id );
The argument count is variable, and the arguments are concatenated with a
":" separator and an appropriate wiki-specific prefix. When there is no
table prefix, the result is the same as the old construction above. When
there is a table prefix, the result will be have a compound prefix, e.g.
"$db-$prefix:user:id$id".
Other similar uses of $wgDBname, such as identifying wikis in log entries,
should be considered deprecated. Instead, use wfWikiID(), which returns the
database name if there is no prefix, and a hyphenated identifier if there is
one.
-- Tim Starling