Caches the output of a command for recall if called again.
Invoke-CachedCommand.ps1 [-Expression] <ScriptBlock> [[-BlockArgs] <PSObject[]>] [-ExpiresAfter <TimeSpan>]
[-ProgressAction <ActionPreference>] [<CommonParameters>]
Invoke-CachedCommand.ps1 [-Expression] <ScriptBlock> [[-BlockArgs] <PSObject[]>] [-Expires <DateTime>]
[-ProgressAction <ActionPreference>] [<CommonParameters>]
Invoke-CachedCommand.ps1 [-Expression] <ScriptBlock> [[-BlockArgs] <PSObject[]>] [-Session]
[-ProgressAction <ActionPreference>] [<CommonParameters>]
Invoke-CachedCommand.ps1 {Invoke-RestMethod https://example.org/endpoint} -Session
Returns the result of executing the script block, or the previous cached output if available.
Specifies the expression to cache the output of.
Type: ScriptBlock
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Parameters to the script block.
Type: PSObject[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: @()
Accept pipeline input: False
Accept wildcard characters: False
The rolling duration to cache the output for (updated with each call).
Type: TimeSpan
Parameter Sets: ExpiresAfter
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Point in time to cache the output until.
Type: DateTime
Parameter Sets: Expires
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Caches the output for this session.
Type: SwitchParameter
Parameter Sets: Session
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.