Skip to content

Commit 26761d9

Browse files
author
James Brundage
committed
feat: Get-GQL -Refresh ( Fixes #2, Fixes #31, Fixes #32 )
1 parent 3f2c850 commit 26761d9

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

Commands/Get-GQL.ps1

+14-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,14 @@ function Get-GQL
7474
# This can be useful for queries that would be run frequently, but change infrequently.
7575
[Parameter(ValueFromPipelineByPropertyName)]
7676
[switch]
77-
$Cache
77+
$Cache,
78+
79+
# If set, will refresh the cache.
80+
# This can be useful to force an update of cached information.
81+
# `-Refresh` implies `-Cache` (it just will not return an uncached value).
82+
[Parameter(ValueFromPipelineByPropertyName)]
83+
[switch]
84+
$Refresh
7885
)
7986

8087
process {
@@ -150,12 +157,17 @@ function Get-GQL
150157
}
151158
#endregion Check for File or Cached Query
152159

160+
if ($PSBoundParameters['Refresh']) {
161+
$Cache = $true
162+
}
163+
153164
if ($Cache -and -not $script:GraphQLOutputCache) {
154165
$script:GraphQLOutputCache = [Ordered]@{}
155166
}
156167

157168
if ($script:GraphQLOutputCache.$gqlQuery -and
158-
-not $Parameter.Count
169+
-not $Parameter.Count -and
170+
-not $Refresh
159171
) {
160172
$script:GraphQLOutputCache.$gqlQuery
161173
continue nextQuery

0 commit comments

Comments
 (0)