Class SecretsCacheService
java.lang.Object
io.github.arve0.onepassword.properties.SecretsCacheService
- All Implemented Interfaces:
org.gradle.api.services.BuildService<org.gradle.api.services.BuildServiceParameters.None>
public abstract class SecretsCacheService
extends Object
implements org.gradle.api.services.BuildService<org.gradle.api.services.BuildServiceParameters.None>
A Gradle
BuildService that caches resolved 1Password secret values for the
duration of a single build.
Gradle's ValueSource deduplication is scoped to a single
project's ProviderFactory. In a multi-project build each
subproject therefore gets its own ProviderFactory, so the same op:// reference
would be resolved once per subproject without this cache.
Because Gradle creates a new BuildService instance for every build (even when the
same daemon handles back-to-back builds), the cache is automatically cleared between builds.
This ensures Gradle's configuration-cache fingerprinting always sees a fresh op call
on the first resolution within each build, while subsequent subprojects sharing the same
reference hit the in-memory map instead of invoking op again.
-
Constructor Details
-
SecretsCacheService
public SecretsCacheService()
-
-
Method Details
-
computeIfAbsent
Returns the cached value forreference, invokingloaderto resolve it if absent.- Parameters:
reference- theop://reference used as the cache keyloader- called at most once per reference per build to fetch the secret- Returns:
- the resolved secret value
-