> 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/de/powershell-befehle/set-psucache.md).

# Set-PSUCache

Set-PSUCache speichert ein Objekt im serverseitigen Cache von PowerShell Universal, mit konfigurierbarem Ablauf, Persistenz und Rollenzugriff.

## SYNOPSIS

Legt ein Objekt im serverweiten Cache ab.

## SYNTAX

```powershell
Set-PSUCache -Key <String> -Value <Object> [-Persist] [-Encrypt] [-ReaderRole <String[]>] [-Depth <Int32>] [<ConnectionOptions>] [<CommonParameters>]
Set-PSUCache -Key <String> -Value <Object> [-AbsoluteExpiration <DateTime>] [-Persist] [-Encrypt] [-ReaderRole <String[]>] [-Depth <Int32>] [<ConnectionOptions>] [<CommonParameters>]
Set-PSUCache -Key <String> -Value <Object> [-AbsoluteExpirationFromNow <TimeSpan>] [-Persist] [-Encrypt] [-ReaderRole <String[]>] [-Depth <Int32>] [<ConnectionOptions>] [<CommonParameters>]
Set-PSUCache -Key <String> -Value <Object> [-SlidingExpiration <TimeSpan>] [-Persist] [-Encrypt] [-ReaderRole <String[]>] [-Depth <Int32>] [<ConnectionOptions>] [<CommonParameters>]
```

`<ConnectionOptions>`: `[-ComputerName <String>] [-AppToken <String>] [-Credential <PSCredential>] [-UseDefaultCredentials] [-Integrated] [-TrustCertificate] [-Cookies]`. `-Role` ist ein Alias von `-ReaderRole`.

## BESCHREIBUNG

Serialisiert einen Wert als CLIXML und speichert ihn im serverweiten Cache, den APIs, Apps und Skripts gemeinsam nutzen; dieser Befehl funktioniert auch über die Verwaltungs-API. Wählen Sie eine Ablaufvariante, oder lassen Sie sie weg, um ohne konfigurierten Ablauf zwischenzuspeichern. Verwenden Sie `-Persist` für die Speicherung in der Datenbank. `-Encrypt` erfordert `-Persist`; die Verwendung ohne Persistenz führt zu einem Fehler.

## BEISPIELE

```powershell
Set-PSUCache -Key 'Data' -Value 'MyValue'
Set-PSUCache -Key 'Data' -Value 'MyValue' -AbsoluteExpiration (Get-Date).AddMinutes(10)
Set-PSUCache -Key 'Data' -Value 'MyValue' -AbsoluteExpirationFromNow ([TimeSpan]::FromMinutes(30))
Set-PSUCache -Key 'Data' -Value 'MyValue' -SlidingExpiration ([TimeSpan]::FromMinutes(10))
Set-PSUCache -Key 'Data' -Value 'MyValue' -Persist -Encrypt
```

Das zweite Beispiel läuft nach zehn Minuten ab, das dritte dreißig Minuten nach der Erstellung und das vierte zehn Minuten nach dem letzten Zugriff.

## PARAMETER

| Parameter                    | Beschreibung                                                              |
| ---------------------------- | ------------------------------------------------------------------------- |
| `-Key`                       | Erforderlicher Cacheschlüssel.                                            |
| `-Value`                     | Erforderliches Objekt, als CLIXML serialisiert.                           |
| `-AbsoluteExpiration`        | Festes Ablaufdatum und feste Ablaufzeit.                                  |
| `-AbsoluteExpirationFromNow` | Dauer von jetzt bis zum Ablauf.                                           |
| `-SlidingExpiration`         | Dauer der Inaktivität bis zum Ablauf; ein Zugriff setzt den Timer zurück. |
| `-Persist`                   | Speichert das Cacheelement dauerhaft in der Datenbank.                    |
| `-Encrypt`                   | Verschlüsselt das persistierte Element; erfordert `-Persist`.             |
| `-ReaderRole`                | Rollen, die das Element lesen dürfen (Alias `-Role`).                     |
| `-Depth`                     | Serialisierungstiefe (Standard 1).                                        |
| `-ComputerName`              | URL oder Hostname des Ziel-PSU-Servers (Alias `-Uri`).                    |
| `-AppToken`                  | App-Token der Verwaltungs-API.                                            |
| `-Credential`                | Anmeldeinformationen der Verwaltungs-API.                                 |
| `-UseDefaultCredentials`     | Verwendet die aktuellen Windows-Anmeldeinformationen.                     |
| `-Integrated`                | Verwendet den prozessinternen Verwaltungsclient.                          |
| `-TrustCertificate`          | Ignoriert Fehler bei der Zertifikatsvalidierung.                          |
| `-Cookies`                   | Verwendet die Authentifizierungscookies der Sitzung erneut.               |

## VERWANDTE LINKS

[Get-PSUCache](/powershell-universal/de/powershell-befehle/get-psucache.md)

## BERECHTIGUNGEN

Das Zugriffstoken erfordert `platform.cache/create`, um einen Cachewert remote festzulegen, auch beim Ersetzen eines vorhandenen Werts.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.devolutions.net/powershell-universal/de/powershell-befehle/set-psucache.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
