License API not caching in Atlassian Connect App?


Our Confluence Cloud Atlassian Connect app is developed using Spring Boot. On a per request basis it is calling the licensing API to check whether the calling tenant has a valid license:

AtlassianLicense retVal = atlassianHostRestClients.authenticatedAsHostActor()
	.getForEntity("/rest/atlassian-connect/1/addons/visio-publisher-for-confluence", AtlassianLicense.class).getBody();

My understanding was that the license was meant to be cached in memory, however it appears that the Spring Boot application call is doing a roundtrip on every call (the elasped time ranges from ~ 150ms to just over 1,000ms ). I would have expected a cached call would be sub millisecond.

Is there any configuration parameter that needs to be set to ensure local caching?

Thanks and regards,

@AndrewTyson you can definitely cache the license data for a short period of time, but there is no built-in support for that in atlassian-connect-spring-boot, nor does that REST endpoint return HTTP caching headers, as far as I know. Your best bet might be using @Cacheable, see Guide: Caching Data with Spring.