I am developing a plugin for Jira Data Center which uses Atlassian Cache. I followed this article:
https://developer.atlassian.com/server/confluence/atlassian-cache-2-overview/
The problem is that my cache works fine locally but it does not want to replicate along Data Center Nodes. I am creating serializable classes but it still does not want to replicate. I am definately missing something. What can be the problem? Maybe someone has an example.
If i check Cache to different Node, it always epmty
@Inject
public SettingsServiceImpl(ActiveObjects activeObjects, CacheFactory cacheFactory, @ComponentImport CacheManager cacheManager) {
this.activeObjects = activeObjects;
this.cacheSettings = new CacheSettingsBuilder().remote().replicateViaCopy().build();
this.cache = cacheManager.getCache(SettingsServiceImpl.class.getName() + ".cache", this::loadSettingFromDatabase
, cacheSettings
);
}
private Setting loadSettingFromDatabase(@Nonnull String name) {
Setting[] settings = activeObjects.find(Setting.class, "NAME = ?", name);
if (settings.length > 0) {
SettingImpl settingImpl = new SettingImpl();
settingImpl.setName(settings[0].getName());
settingImpl.setValue(settings[0].getValue());
return settingImpl;
} else {
log.info("Setting '{}' not found in database", name);
return null;
}
}
}