-
Couldn't load subscription status.
- Fork 8
Client credentials caching
The library comes with options for caching client credentials, thus avoiding to call Oauth endpoints on each authenticated API invocation.
By default, the library does not cache any token. To enable the caching feature there are two options: using a default in-memory cache or define custom cache storage. Either way developers are not asked to provide an implementation that takes care of the expiration of the token.
To enable the default in memory cache it's enough to invoke the withCredentialsCaching() on the client builder instance.
TrueLayerClientBuilder sut = new TrueLayerClientBuilder()
.clientCredentials(getClientCredentials())
.signingOptions(getSigningOptions())
.withHttpLogs()
.withCredentialsCaching();
To define a custom cache storage you can provide an implementation of the ICredentialsCache interface:
TrueLayerClientBuilder sut = new TrueLayerClientBuilder()
.clientCredentials(getClientCredentials())
.signingOptions(getSigningOptions())
.withHttpLogs()
.withCredentialsCaching(MyCustomCacheImpl);