|
|
|
@ -207,7 +207,10 @@ public class DeviceServiceImpl extends AbstractEntityService implements DeviceSe |
|
|
|
return doSaveDevice(device, null, true); |
|
|
|
} |
|
|
|
|
|
|
|
@CacheEvict(cacheNames = DEVICE_CACHE, key = "{#device.tenantId, #device.name}") |
|
|
|
@Caching(evict= { |
|
|
|
@CacheEvict(cacheNames = DEVICE_CACHE, key = "{#device.tenantId, #device.name}"), |
|
|
|
@CacheEvict(cacheNames = DEVICE_CACHE, key = "{#device.tenantId, #device.id}") |
|
|
|
}) |
|
|
|
@Override |
|
|
|
public Device saveDeviceWithCredentials(Device device, DeviceCredentials deviceCredentials) { |
|
|
|
if (device.getId() == null) { |
|
|
|
@ -631,7 +634,7 @@ public class DeviceServiceImpl extends AbstractEntityService implements DeviceSe |
|
|
|
throw new ProvisionFailedException(ProvisionResponseStatus.FAILURE.name()); |
|
|
|
} |
|
|
|
} |
|
|
|
removeDeviceFromCacheById(savedDevice.getTenantId(), savedDevice.getId()); |
|
|
|
removeDeviceFromCacheById(savedDevice.getTenantId(), savedDevice.getId()); // eviction by name is described as annotation @CacheEvict above
|
|
|
|
return savedDevice; |
|
|
|
} |
|
|
|
|
|
|
|
@ -721,6 +724,7 @@ public class DeviceServiceImpl extends AbstractEntityService implements DeviceSe |
|
|
|
} |
|
|
|
if (!old.getName().equals(device.getName())) { |
|
|
|
removeDeviceFromCacheByName(tenantId, old.getName()); |
|
|
|
removeDeviceFromCacheById(tenantId, device.getId()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|