

Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.

# SecretCache
<a name="retrieving-secrets_cache-ref-secretcache"></a>

Una cache in memoria per i segreti recuperati da Secrets Manager. Si usa [get\_secret\_string](#retrieving-secrets_cache-ref-secretcache_get_secret_string) o [get\_secret\_binary](#retrieving-secrets_cache-ref-secretcache_get_secret_binary) per recuperare un segreto dalla cache. È possibile configurare le impostazioni della cache specificando un oggetto [SecretCacheConfig](retrieving-secrets_cache-ref-secretcacheconfig.md) nel costruttore. 

Per ulteriori informazioni, inclusi esempi, consulta [Ottieni un valore segreto di Secrets Manager usando Python con caching lato client](retrieving-secrets_cache-python.md).

```
cache = SecretCache(
    config = SecretCacheConfig,
    client = [client](https://botocore.amazonaws.com/v1/documentation/api/latest/reference/services/secretsmanager.html)
)
```

**Topics**
+ [get\_secret\_string](#retrieving-secrets_cache-ref-secretcache_get_secret_string)
+ [get\_secret\_binary](#retrieving-secrets_cache-ref-secretcache_get_secret_binary)

## get\_secret\_string
<a name="retrieving-secrets_cache-ref-secretcache_get_secret_string"></a>

Recupera il valore della stringa del segreto.

Sintassi della richiesta  

```
response = cache.get_secret_string(
    secret_id='{{string}}',
    version_stage='{{string}}' )
```

Parameters  
+ `secret_id`(*string*): [Obbligatorio] Il nome o l'ARN del segreto.
+ `version_stage`(*stringa*): La versione dei segreti che desideri recuperare. Per ulteriori informazioni, [consulta Versioni segrete](whats-in-a-secret.md). Il valore predefinito è "AWSCURRENT". 

Tipo restituito  
stringa

## get\_secret\_binary
<a name="retrieving-secrets_cache-ref-secretcache_get_secret_binary"></a>

Recupera il valore binario del segreto.

Sintassi della richiesta  

```
response = cache.get_secret_binary(
    secret_id='{{string}}',
    version_stage='{{string}}'
)
```

Parameters  
+ `secret_id`(*string*): [Obbligatorio] Il nome o l'ARN del segreto.
+ `version_stage`(*stringa*): La versione dei segreti che desideri recuperare. Per ulteriori informazioni, [consulta Versioni segrete](whats-in-a-secret.md). Il valore predefinito è "AWSCURRENT". 

Tipo restituito  
Stringa [con codifica Base64](https://tools.ietf.org/html/rfc4648#section-4)