-
Notifications
You must be signed in to change notification settings - Fork 0
Set PodeState
Sets an object within the shared state.
Set-PodeState -Name <String> [[-Value] <Object>] [-Scope <String[]>] [-ProgressAction <ActionPreference>]
[<CommonParameters>]
Set-PodeState -Name <String> [-Scope <String[]>] -NewCollectionType <String>
[-ProgressAction <ActionPreference>] [<CommonParameters>]
Sets an object within the shared state, allowing for the creation of different collection types, such as a Hashtable, ConcurrentDictionary, or other concurrent collections.
Set-PodeState -Name 'Data' -Value @{ 'Name' = 'Rick Sanchez' }
Set-PodeState -Name 'Users' -Value @('user1', 'user2') -Scope General, Users
Set-PodeState -Name 'Cache' -NewCollectionType 'ConcurrentDictionary'
Set-PodeState -Name 'Tasks' -NewCollectionType 'ConcurrentQueue'
The name of the state object.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies the type of collection to create. Supported options include:
- Hashtable
- ConcurrentDictionary
- OrderedDictionary
- ConcurrentBag
- ConcurrentQueue
- ConcurrentStack
If this parameter is used, the state object will be initialized as the specified collection type.
Type: String
Parameter Sets: Collection
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
{{ Fill ProgressAction Description }}
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
An optional scope for the state object, used when saving the state.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The value to set in the state. If a collection type is specified using `-NewCollectionType`, this value is ignored.
Type: Object
Parameter Sets: Value
Aliases:
Required: False
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
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.
- `NewCollectionType` and `Value` are mutually exclusive; only one can be used at a time.
- The function ensures thread safety when using concurrent collections.
- Pode must be initialized before calling this function.
sss
x