< Back

Set-PSFResultCache

Sun Jan 19, 2020 6:44 pm

NAME Set-PSFResultCache



SYNOPSIS

Stores a result in the result cache





SYNTAX

Set-PSFResultCache [-InputObject] <Object> [-DisableCache <Boolean>] [-PassThru] [-CommandName <String>]

[<CommonParameters>]





DESCRIPTION

Stores a result in the result cache.

This function is designed for use in other functions, a user should never have cause to use it directly himself.





PARAMETERS

-InputObject <Object>

The value to store in the result cache.



Required? true

Position? 1

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-DisableCache <Boolean>

Allows you to control, whether the function actually writes to the cache. Useful when used in combination with

-PassThru.

Does not suppress output via -PassThru. However in combination, these two parameters make caching within a

pipeline practical.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-PassThru [<SwitchParameter>]

The objects that are being cached are passed through this function.

By default, Set-PSFResultCache doesn't have any output.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-CommandName <String>

Default: (Get-PSCallStack)[0].Command

The name of the command that called Set-PSFResultCache.

Is automatically detected and usually doesn't need to be changed.



Required? false

Position? named

Default value (Get-PSCallStack)[0].Command

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Set-PSFResultCache -InputObject $Results -DisableCache $NoRes



Stores the contents of $Results in the result cache, but does nothing if $NoRes is $true (the default Switch-name

for disabling the result cache)









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Get-ChildItem $path | Get-Acl | Set-PSFResultCache -DisableCache $NoRes -PassThru



Gets all items in $Path, then retrieves each of their Acl, finally it stores those in the result cache (if it

isn't disabled via $NoRes) and finally passes each Acl through for the user to see.

This will return all objects, even if $NoRes is set to $True.











RELATED LINKS