From f37fa2bbf5aa9385215a6fb1da15798fc413cf65 Mon Sep 17 00:00:00 2001 From: Daniel Hougaard <62331820+DanielHougaard@users.noreply.github.com> Date: Sun, 24 Dec 2023 17:10:54 +0400 Subject: [PATCH] Updated Java docs --- docs/sdks/languages/java.mdx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/sdks/languages/java.mdx b/docs/sdks/languages/java.mdx index a73d1bd09..5f4c7d557 100644 --- a/docs/sdks/languages/java.mdx +++ b/docs/sdks/languages/java.mdx @@ -19,6 +19,7 @@ public class Example { ClientSettings settings = new ClientSettings(); settings.setClientID("MACHINE_IDENTITY_CLIENT_ID"); settings.setClientSecret("MACHINE_IDENTITY_CLIENT_SECRET"); + settings.setCacheTTL(Long.valueOf(300)); // 300 seconds, 5 minutes InfisicalClient client = new InfisicalClient(settings); @@ -88,6 +89,11 @@ public class App { An access token obtained from the machine identity login endpoint. + + Time-to-live (in seconds) for refreshing cached secrets. + If manually set to 0, caching will be disabled, this is not recommended. + + Your self-hosted absolute site URL including the protocol (e.g. `https://app.infisical.com`) @@ -95,6 +101,10 @@ public class App { +### Caching + +The SDK caches every secret and updates it periodically based on the provided cacheTTL. For example, if cacheTTL of 300 is provided, then a secret will be refetched every 5 minutes. The SDK first attempts to return the cached secret, but if no secret is found it'll make a request to get the fresh secret. Every time the secret is fetched from the cache, the cached secret expiry is reset. + ## Working with Secrets ### client.listSecrets(options) @@ -127,7 +137,11 @@ Retrieve all secrets within the Infisical project and environment that client is The path from where secrets should be fetched from. - + + Whether or not to set the fetched secrets to the process environment. If true, you can access the secrets like so `System.getenv("SECRET_NAME")`. + + + Whether or not to include imported secrets from the current path. Read about [secret import](/documentation/platform/secret-reference)