diff --git a/docs/sdks/languages/java.mdx b/docs/sdks/languages/java.mdx index a73d1bd09..7c3ec5599 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 + +To reduce the number of API requests, the SDK temporarily stores secrets it retrieves. By default, a secret remains cached for 5 minutes after it's first fetched. Each time it's fetched again, this 5-minute timer resets. You can adjust this caching duration by setting the "cacheTTL" option when creating the client. + ## 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) diff --git a/docs/sdks/languages/node.mdx b/docs/sdks/languages/node.mdx index 34cce93ab..9179e2f9d 100644 --- a/docs/sdks/languages/node.mdx +++ b/docs/sdks/languages/node.mdx @@ -104,6 +104,11 @@ Import the SDK and create a client instance with your [Machine Identity](/docume 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`) @@ -113,6 +118,11 @@ Import the SDK and create a client instance with your [Machine Identity](/docume + +### Caching + +To reduce the number of API requests, the SDK temporarily stores secrets it retrieves. By default, a secret remains cached for 5 minutes after it's first fetched. Each time it's fetched again, this 5-minute timer resets. You can adjust this caching duration by setting the "cacheTtl" option when creating the client. + ## Working with Secrets ### client.listSecrets(options) @@ -143,7 +153,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 `process.env["SECRET_NAME"]`. + + + Whether or not to include imported secrets from the current path. Read about [secret import](/documentation/platform/secret-reference) diff --git a/docs/sdks/languages/python.mdx b/docs/sdks/languages/python.mdx index e8c4a90c6..8420e6e77 100644 --- a/docs/sdks/languages/python.mdx +++ b/docs/sdks/languages/python.mdx @@ -62,24 +62,40 @@ client = InfisicalClient(ClientSettings( ### Parameters - - Your Infisical Client ID. - - - Your Infisical Client Secret. - - - If you want to directly pass an access token obtained from the authentication endpoints, you can do so. - - - Your self-hosted absolute site URL including the protocol (e.g. - `https://app.infisical.com`) - + + + + Your Infisical Client ID. + + + Your Infisical Client Secret. + + + If you want to directly pass an access token obtained from the authentication endpoints, you can do so. + + + + 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`) + + + + + +### Caching + +To reduce the number of API requests, the SDK temporarily stores secrets it retrieves. By default, a secret remains cached for 5 minutes after it's first fetched. Each time it's fetched again, this 5-minute timer resets. You can adjust this caching duration by setting the "cache_ttl" option when creating the client. ## Working with Secrets @@ -109,7 +125,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 `process.env["SECRET_NAME"]`. + + + Whether or not to include imported secrets from the current path. Read about [secret import](/documentation/platform/secret-reference) @@ -148,7 +168,7 @@ By default, `getSecret()` fetches and returns a shared secret. If not found, it The type of the secret. Valid options are "shared" or "personal". If not specified, the default value is "personal". - + Whether or not to include imported secrets from the current path. Read about [secret import](/documentation/platform/secret-reference) diff --git a/docs/sdks/overview.mdx b/docs/sdks/overview.mdx index b26330f18..aca673c49 100644 --- a/docs/sdks/overview.mdx +++ b/docs/sdks/overview.mdx @@ -31,3 +31,23 @@ From local development to production, Infisical SDKs provide the easiest way for Manage secrets for your PHP application on demand + +## FAQ + + + + The client SDK caches every secret and implements a 5-minute waiting period before re-requesting it. The waiting period can be controlled by + setting the `cacheTTL` parameter at the time of initializing the client. + + Note: The exact parameter name may differ depending on the language. + + + Yes you can! The client SDK provides a method to attach the secrets to your process environment. When using the `listSecrets()` method, you + can pass a `attachToProcessEnv` parameter, which tells the SDK to attach all the found secrets to your process environment. + + Note: The exact parameter name may differ depending on the language. + + + The SDK caches every secret and falls back to the cached value if a request fails. If no cached value is found, and the request fails, then the SDK throws an error. + +