Add-KrCacheResponse

SYNOPSIS

Adds caching headers to the HTTP response.

SYNTAX

__AllParameterSets

Add-KrCacheResponse [[-MaxAge] <int>] [[-SharedMaxAge] <int>] [[-MaxStaleLimit] <int>]
 [[-MinFresh] <int>] [-NoCache] [-NoStore] [-MaxStale] [-NoTransform] [-OnlyIfCached] [-Public]
 [-Private] [-MustRevalidate] [-ProxyRevalidate] [<CommonParameters>]

ALIASES

This cmdlet has the following aliases, {{Insert list of aliases}}

DESCRIPTION

This cmdlet allows you to add caching headers to the HTTP response in a route script block. It provides various parameters to customize the caching behavior, such as setting max-age, no-cache, no-store, and other cache control directives.

EXAMPLES

EXAMPLE 1

Add-KrCacheResponse -NoCache -MaxAge 3600 -Public This example adds caching headers to the response, setting the ‘no-cache’ directive, a ‘max-age’ of 3600 seconds, and marking the response as ‘public’.

EXAMPLE 2

Add-KrCacheResponse -NoStore -Private -MustRevalidate This example adds caching headers to the response, setting the ‘no-store’ directive, marking the response as ‘private’, and adding the ‘must-revalidate’ directive.

PARAMETERS

-MaxAge

If specified, sets the ‘max-age’ directive in seconds for the Cache-Control header.

Type: System.Int32
DefaultValue: 0
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 0
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-MaxStale

If specified, the ‘max-stale’ directive will be added to the Cache-Control header.

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-MaxStaleLimit

If specified, sets the limit in seconds for the ‘max-stale’ directive in the Cache-Control header.

Type: System.Int32
DefaultValue: 0
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 2
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-MinFresh

If specified, sets the ‘min-fresh’ directive in seconds for the Cache-Control header.

Type: System.Int32
DefaultValue: 0
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 3
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-MustRevalidate

If specified, the ‘must-revalidate’ directive will be added to the Cache-Control header.

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-NoCache

If specified, the ‘no-cache’ directive will be added to the Cache-Control header.

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-NoStore

If specified, the ‘no-store’ directive will be added to the Cache-Control header.

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-NoTransform

If specified, the ‘no-transform’ directive will be added to the Cache-Control header.

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-OnlyIfCached

If specified, the ‘only-if-cached’ directive will be added to the Cache-Control header.

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Private

If specified, the ‘private’ directive will be added to the Cache-Control header.

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-ProxyRevalidate

If specified, the ‘proxy-revalidate’ directive will be added to the Cache-Control header.

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Public

If specified, the ‘public’ directive will be added to the Cache-Control header.

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-SharedMaxAge

If specified, sets the ‘s-maxage’ directive in seconds for the Cache-Control header (used by shared caches).

Type: System.Int32
DefaultValue: 0
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 1
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

NOTES

This cmdlet is used to add caching headers to the response in a route script block, allowing you to control how responses are cached by clients and intermediate caches. It must be used within a route script block where the $Context variable is available.

{{ Fill in the related links here }}