Fix cache issue when billing cache is enabled

This commit is contained in:
Lasantha Dharmakeerthi 2023-05-10 04:24:26 +00:00
commit 09aab16faa
2 changed files with 3 additions and 1 deletions

View File

@ -110,6 +110,7 @@ public class MetadataServiceImpl implements MetadataService {
RequestValidationUtil.validateMetadata(metadata);
try {
Metadata createdMetadata = DeviceMgtAPIUtils.getMetadataManagementService().createMetadata(metadata);
DeviceManagerUtil.removeBillingCache();
return Response.status(Response.Status.CREATED).entity(createdMetadata).build();
} catch (MetadataKeyAlreadyExistsException e) {
String msg = "Metadata entry metaKey:" + metadata.getMetaKey() + " is already exist.";

View File

@ -701,7 +701,8 @@ public final class DeviceManagerUtil {
*/
public static void removeBillingCache() {
CacheManager manager = getCacheManager();
manager.removeCache(DeviceManagementConstants.BILLING_CACHE);
Cache cache = manager.getCache(DeviceManagementConstants.BILLING_CACHE);
cache.removeAll();
}
/**