public function getPrefix($ForcePrefix = null, $WithRevision = true)
{
static $ConfigPrefix = false;
// Allow overriding the prefix
if (!is_null($ForcePrefix)) {
return $ForcePrefix;
}
// Keep searching for the prefix until it is defined
if ($ConfigPrefix === false) {
// Allow vfcom-infrastructure to set the prefix automatically
if (defined('FORCE_CACHE_PREFIX')) {
$ConfigPrefix = FORCE_CACHE_PREFIX;
}
if ($ConfigPrefix === false) {
$ConfigPrefix = c('Cache.Prefix', false);
}
}
// Lookup Revision if we have a prefix.
$RevisionNumber = false;
if ($WithRevision && $ConfigPrefix !== false) {
$CacheRevision = $this->getRevision($ConfigPrefix);
if (!is_null($CacheRevision)) {
$RevisionNumber = $CacheRevision;
}
}
$Response = $ConfigPrefix;
if ($WithRevision && $RevisionNumber !== false && $ConfigPrefix !== false) {
$Response .= ".rev{$RevisionNumber}";
}
return $ConfigPrefix === false ? null : $Response;
}