Source:
<code>public Response invalidatesCacheByTenant(@QueryParam("tenantApiKey") final String tenantApiKey, @javax.ws.rs.core.Context final HttpServletRequest request) throws TenantApiException { TenantContext tenantContext = context.createContext(request); Tenant currentTenant = tenantApi.getTenantById(tenantContext.getTenantId()); Long tenantRecordId = recordIdApi.getRecordId(tenantContext.getTenantId(), ObjectType.TENANT, tenantContext); final Ehcache tenantRecordIdCache = cacheManager.getEhcache(CacheType.TENANT_RECORD_ID.getCacheName()); tenantRecordIdCache.remove(currentTenant.getId().toString()); final Ehcache tenantPaymentStateMachineConfigCache = cacheManager.getEhcache(CacheType.TENANT_PAYMENT_STATE_MACHINE_CONFIG.getCacheName()); <START> String tenantPaymentStateMachineConfigCacheKey = "PLUGIN_PAYMENT_STATE_MACHINE_noop::" + tenantRecordId.toString(); <END> tenantPaymentStateMachineConfigCache.remove(tenantPaymentStateMachineConfigCacheKey); final Ehcache tenantCache = cacheManager.getEhcache(CacheType.TENANT.getCacheName()); tenantCache.remove(currentTenant.getApiKey()); final Ehcache tenantKvCache = cacheManager.getEhcache(CacheType.TENANT_KV.getCacheName()); String tenantKvCacheKey = "PUSH_NOTIFICATION_CB::" + tenantRecordId.toString(); tenantKvCache.remove(tenantKvCacheKey); final Ehcache tenantConfigCache = cacheManager.getEhcache(CacheType.TENANT_CONFIG.getCacheName()); tenantConfigCache.remove(tenantRecordId); final Ehcache tenantOverdueConfigCache = cacheManager.getEhcache(CacheType.TENANT_OVERDUE_CONFIG.getCacheName()); tenantOverdueConfigCache.remove(tenantRecordId); final Ehcache tenantCatalogCache = cacheManager.getEhcache(CacheType.TENANT_CATALOG.getCacheName()); tenantCatalogCache.remove(tenantRecordId); return Response.status(Status.OK).build(); }</code><technical_language>enough: tenant multiple entries (one payment plugin registered). need iterate keys</technical_language>

Target:
public Response invalidatesCacheByTenant(@QueryParam("tenantApiKey") final String tenantApiKey, @javax.ws.rs.core.Context final HttpServletRequest request) throws TenantApiException { TenantContext tenantContext = context.createContext(request); Tenant currentTenant = tenantApi.getTenantById(tenantContext.getTenantId()); Long tenantRecordId = recordIdApi.getRecordId(tenantContext.getTenantId(), ObjectType.TENANT, tenantContext); final Ehcache tenantRecordIdCache = cacheManager.getEhcache(CacheType.TENANT_RECORD_ID.getCacheName()); tenantRecordIdCache.remove(currentTenant.getId().toString()); final Ehcache tenantPaymentStateMachineConfigCache = cacheManager.getEhcache(CacheType.TENANT_PAYMENT_STATE_MACHINE_CONFIG.getCacheName()); removeCacheByKey(tenantPaymentStateMachineConfigCache, tenantRecordId.toString()); final Ehcache tenantCache = cacheManager.getEhcache(CacheType.TENANT.getCacheName()); tenantCache.remove(currentTenant.getApiKey()); final Ehcache tenantKvCache = cacheManager.getEhcache(CacheType.TENANT_KV.getCacheName()); removeCacheByKey(tenantKvCache, tenantRecordId.toString()); final Ehcache tenantConfigCache = cacheManager.getEhcache(CacheType.TENANT_CONFIG.getCacheName()); tenantConfigCache.remove(tenantRecordId); final Ehcache tenantOverdueConfigCache = cacheManager.getEhcache(CacheType.TENANT_OVERDUE_CONFIG.getCacheName()); tenantOverdueConfigCache.remove(tenantRecordId); final Ehcache tenantCatalogCache = cacheManager.getEhcache(CacheType.TENANT_CATALOG.getCacheName()); tenantCatalogCache.remove(tenantRecordId); return Response.status(Status.OK).build(); }