Skip to content

Commit 6c6074d

Browse files
committed
⚡ Flush Modulefast Cache on -Update
1 parent 7836985 commit 6c6074d

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

ModuleFast.psm1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,11 @@ function Install-ModuleFast {
234234
# Setup the Destination repository
235235
$defaultRepoPath = $(Join-Path ([Environment]::GetFolderPath('LocalApplicationData')) 'powershell/Modules')
236236

237+
#Clear the ModuleFastCache if -Update is specified to ensure fresh lookups of remote module availability
238+
if ($Update) {
239+
Clear-ModuleFastCache
240+
}
241+
237242
if (-not $Destination) {
238243
$Destination = $defaultRepoPath
239244
} elseif ($IsWindows -and $Destination -eq 'CurrentUser') {
@@ -827,6 +832,7 @@ function Clear-ModuleFastCache {
827832
.SYNOPSIS
828833
Clears the ModuleFast HTTP Cache. This is useful if you are expecting a newer version of a module to be available.
829834
#>
835+
Write-Debug "Flushing ModuleFast Request Cache"
830836
$SCRIPT:RequestCache.Dispose()
831837
$SCRIPT:RequestCache = [MemoryCache]::new('PowerShell-ModuleFast-RequestCache')
832838
}

0 commit comments

Comments
 (0)