> For the complete documentation index, see [llms.txt](https://docs.devolutions.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devolutions.net/powershell-universal/it/comandi-powershell/set-psucache.md).

# Set-PSUCache

## SINOSSI

Imposta un oggetto nella cache lato server di PowerShell Universal.

## SINTASSI

### None (Default)

```
Set-PSUCache -Key <String> -Value <Object> [-Persist] [-Role <String[]>] [-Depth <Int32>]
 [-ComputerName <String>] [-AppToken <String>] [-Credential <PSCredential>] [-UseDefaultCredentials]
 [-Integrated] [-TrustCertificate] [-Cookies] [<CommonParameters>]
```

### Absolute

```
Set-PSUCache -Key <String> -Value <Object> [-AbsoluteExpiration <DateTime>] [-Persist] [-Role <String[]>]
 [-Depth <Int32>] [-ComputerName <String>] [-AppToken <String>] [-Credential <PSCredential>]
 [-UseDefaultCredentials] [-Integrated] [-TrustCertificate] [-Cookies]
 [<CommonParameters>]
```

### AbsoluteExpirationFromNow

```
Set-PSUCache -Key <String> -Value <Object> [-AbsoluteExpirationFromNow <TimeSpan>] [-Persist]
 [-Role <String[]>] [-Depth <Int32>] [-ComputerName <String>] [-AppToken <String>] [-Credential <PSCredential>]
 [-UseDefaultCredentials] [-Integrated] [-TrustCertificate] [-Cookies]
 [<CommonParameters>]
```

### SlidingExpiration

```
Set-PSUCache -Key <String> -Value <Object> [-SlidingExpiration <TimeSpan>] [-Persist] [-Role <String[]>]
 [-Depth <Int32>] [-ComputerName <String>] [-AppToken <String>] [-Credential <PSCredential>]
 [-UseDefaultCredentials] [-Integrated] [-TrustCertificate] [-Cookies]
 [<CommonParameters>]
```

## DESCRIZIONE

Imposta un oggetto nella cache lato server di PowerShell Universal. Questo cmdlet deve essere utilizzato all'interno di API, Dashboard e Script. Non è possibile recuperare i dati della cache dalla Management API.

## ESEMPI

### Esempio 1

```powershell
PS C:\> Set-PSUCache -Key 'Data' -Value 'MyValue'
```

Memorizza i dati nella cache a livello di server in modo permanente.

### Esempio 2

```powershell
PS C:\> Set-PSUCache -Key 'Data' -Value 'MyValue' -AbsoluteExpiration (Get-Date).AddMinutes(10)
```

Memorizza i dati nella cache con scadenza tra 10 minuti.

### Esempio 3

```powershell
PS C:\> Set-PSUCache -Key 'Data' -Value 'MyValue' -AbsoluteExpirationFromNow [TimeSpan]::FromMinutes(30)
```

Memorizza i dati nella cache con scadenza tra 30 minuti.

### Esempio 4

```powershell
PS C:\> Set-PSUCache -Key 'Data' -Value 'MyValue' -SlidingExpiration [TimeSpan]::FromMinutes(10)
```

Memorizza i dati nella cache con una scadenza scorrevole di 10 minuti. Se i dati non vengono consultati per 10 minuti, verranno invalidati e rimossi dalla cache. Se i dati vengono consultati, il timer verrà reimpostato per altri 10 minuti.

## PARAMETRI

### -AbsoluteExpiration

Un orario di scadenza assoluto per i dati nella cache.

```yaml
Type: DateTime
Parameter Sets: Absolute
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -AbsoluteExpirationFromNow

Un TimeSpan che indica tra quanto tempo, a partire da adesso, i dati devono essere rimossi dalla cache.

```yaml
Type: TimeSpan
Parameter Sets: AbsoluteExpirationFromNow
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Key

Una chiave per la ricerca dei dati nella cache.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -SlidingExpiration

Un TimeSpan che indica la scadenza scorrevole per i dati nella cache.

```yaml
Type: TimeSpan
Parameter Sets: SlidingExpiration
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Value

L'oggetto da archiviare nella cache. Questo oggetto verrà serializzato in CLIXML.

```yaml
Type: Object
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -AppToken

Specifica il token dell'app da utilizzare per l'autenticazione alla management API di PowerShell Universal.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -ComputerName

Specifica l'URL o il nome host dell'istanza di PowerShell Universal di destinazione. I nomi host semplici vengono normalizzati in un URL http\://:5000.

```yaml
Type: String
Parameter Sets: (All)
Aliases: Uri

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Integrated

Esegue il comando internamente anziché utilizzare la Management API. Funziona solo quando lo script viene eseguito all'interno di PowerShell Universal.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -UseDefaultCredentials

Fornisce le credenziali di Windows durante l'autenticazione con PowerShell Universal.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Credential

Credenziali per l'accesso alla Management API di PowerShell Universal.

```yaml
Type: PSCredential
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Persist

Rende persistenti i dati della cache nel database.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Role

I ruoli che hanno accesso a questi dati memorizzati nella cache.

```yaml
Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -TrustCertificate

Indica se il cmdlet deve ignorare i problemi relativi ai certificati.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Cookies

Riutilizza e rende persistenti i cookie di autenticazione per la sessione PowerShell corrente.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Depth

Specifica la profondità di serializzazione da utilizzare durante la conversione dei valori prima di inviarli al server.

```yaml
Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### CommonParameters

Questo cmdlet supporta i parametri comuni: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -Verbose, -WarningAction, -WarningVariable e -ProgressAction. Per maggiori informazioni, veda [about\_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).

## INPUT

### Nessuno

## OUTPUT

### System.Object

## NOTE

## COLLEGAMENTI CORRELATI

[Get-PSUCache](/powershell-universal/it/comandi-powershell/get-psucache.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.devolutions.net/powershell-universal/it/comandi-powershell/set-psucache.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
