Skip to content

Commit

Permalink
feat: Get-GQL -Refresh ( Fixes #2, Fixes #31, Fixes #32 )
Browse files Browse the repository at this point in the history
  • Loading branch information
James Brundage committed Dec 18, 2024
1 parent 3f2c850 commit 26761d9
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions Commands/Get-GQL.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,14 @@ function Get-GQL
# This can be useful for queries that would be run frequently, but change infrequently.
[Parameter(ValueFromPipelineByPropertyName)]
[switch]
$Cache
$Cache,

# If set, will refresh the cache.
# This can be useful to force an update of cached information.
# `-Refresh` implies `-Cache` (it just will not return an uncached value).
[Parameter(ValueFromPipelineByPropertyName)]
[switch]
$Refresh
)

process {
Expand Down Expand Up @@ -150,12 +157,17 @@ function Get-GQL
}
#endregion Check for File or Cached Query

if ($PSBoundParameters['Refresh']) {
$Cache = $true
}

if ($Cache -and -not $script:GraphQLOutputCache) {
$script:GraphQLOutputCache = [Ordered]@{}
}

if ($script:GraphQLOutputCache.$gqlQuery -and
-not $Parameter.Count
-not $Parameter.Count -and
-not $Refresh
) {
$script:GraphQLOutputCache.$gqlQuery
continue nextQuery
Expand Down

0 comments on commit 26761d9

Please sign in to comment.