Functions/Cache/Remove-CachedWebRequest.ps1
function Remove-CachedWebRequest { [CmdletBinding(SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [string] $Uri ) begin { if (-not $PSBoundParameters.ContainsKey('Confirm')) { $ConfirmPreference = $PSCmdlet.SessionState.PSVariable.GetValue('ConfirmPreference') } if (-not $PSBoundParameters.ContainsKey('WhatIf')) { $WhatIfPreference = $PSCmdlet.SessionState.PSVariable.GetValue('WhatIfPreference') } } process { if ($Force -or $PSCmdlet.ShouldProcess("Remove URL '$Uri' from cache?")) { $null = $script:Cache.Remove($Uri) } } } |