Utilities/Get-DefaultProviders.ps1

function Get-DefaultProviders {
    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseSingularNouns', '', Justification = 'Intentional plural for clarity: returns multiple providers.')]

    $defaultCacheFolder =
    if ($PSVersionTable.PSEdition -ne 'Core' -or $IsWindows) {
        Join-Path $Env:LOCALAPPDATA "ExpressionCache\$($script:Config.AppName)"
    }
    else {
        Join-Path $HOME ".cache/ExpressionCache/$($script:Config.AppName)"
    }

    # Return an ordered hashtable keyed by short provider key; values are hashtables
    $providers = [ordered]@{
        LocalFileSystemCache = @{
            Name        = 'LocalFileSystemCache'
            Description = 'Stores cached expressions in the local file system.'
            Config      = @{
                ProviderName  = 'LocalFileSystemCache'
                CacheVersion  = 1
                CacheFolder   = $defaultCacheFolder
                DefaultMaxAge = (New-TimeSpan -Days 1)
                JsonDepth     = 10
            }
            GetOrCreate = 'Get-LocalFileSystem-CachedValue'
            Initialize  = 'Initialize-LocalFileSystem-Cache'
            ClearCache  = 'Clear-LocalFileSystem-Cache'   
        }

        Redis                = @{
            # Align Name with key to avoid key/name mismatch downstream
            Name        = 'Redis'
            Config      = @{
                ProviderName        = 'Redis'   # used as key/identifier consistently
                HostAddress         = '127.0.0.1'
                Port                = 6379
                Database            = 2
                Prefix              = "ExpressionCache:v$($Script:moduleData.ModuleVersion.Major):$($script:Config.AppName)"
                Password            = if ($env:EXPRCACHE_REDIS_PASSWORD) { $env:EXPRCACHE_REDIS_PASSWORD } else { '' }
                DefaultMaxAge       = (New-TimeSpan -Days 1)
                DeferClientCreation = $true
            }
            GetOrCreate = 'Get-Redis-CachedValue'
            Initialize  = 'Initialize-Redis-Cache'
            ClearCache  = 'Clear-Redis-Cache'             
        }
    }

    return $providers        
}