|
|
@ -24,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.cache.Cache; |
|
|
import org.springframework.cache.Cache; |
|
|
import org.springframework.cache.CacheManager; |
|
|
import org.springframework.cache.CacheManager; |
|
|
import org.springframework.cache.annotation.CacheEvict; |
|
|
import org.springframework.cache.annotation.CacheEvict; |
|
|
|
|
|
import org.springframework.cache.annotation.CachePut; |
|
|
import org.springframework.cache.annotation.Cacheable; |
|
|
import org.springframework.cache.annotation.Cacheable; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.thingsboard.server.common.data.Customer; |
|
|
import org.thingsboard.server.common.data.Customer; |
|
|
@ -88,7 +89,7 @@ public class EntityViewServiceImpl extends AbstractEntityService implements Enti |
|
|
@Autowired |
|
|
@Autowired |
|
|
private CacheManager cacheManager; |
|
|
private CacheManager cacheManager; |
|
|
|
|
|
|
|
|
// @Cacheable(cacheNames = ENTITY_VIEW_CACHE, key = "{#entityViewId}")
|
|
|
@Cacheable(cacheNames = ENTITY_VIEW_CACHE) |
|
|
@Override |
|
|
@Override |
|
|
public EntityView findEntityViewById(EntityViewId entityViewId) { |
|
|
public EntityView findEntityViewById(EntityViewId entityViewId) { |
|
|
log.trace("Executing findEntityViewById [{}]", entityViewId); |
|
|
log.trace("Executing findEntityViewById [{}]", entityViewId); |
|
|
@ -104,7 +105,7 @@ public class EntityViewServiceImpl extends AbstractEntityService implements Enti |
|
|
.orElse(null); |
|
|
.orElse(null); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// @CacheEvict(cacheNames = ENTITY_VIEW_CACHE, key = "{#entityView.id}")
|
|
|
@CachePut(cacheNames = ENTITY_VIEW_CACHE) |
|
|
@Override |
|
|
@Override |
|
|
public EntityView saveEntityView(EntityView entityView) { |
|
|
public EntityView saveEntityView(EntityView entityView) { |
|
|
log.trace("Executing save entity view [{}]", entityView); |
|
|
log.trace("Executing save entity view [{}]", entityView); |
|
|
@ -136,7 +137,7 @@ public class EntityViewServiceImpl extends AbstractEntityService implements Enti |
|
|
List<Object> list = new ArrayList<>(); |
|
|
List<Object> list = new ArrayList<>(); |
|
|
list.add(entityView.getTenantId()); |
|
|
list.add(entityView.getTenantId()); |
|
|
list.add(entityView.getName()); |
|
|
list.add(entityView.getName()); |
|
|
// cache.evict(list);
|
|
|
cache.evict(list); |
|
|
entityViewDao.removeById(entityViewId.getId()); |
|
|
entityViewDao.removeById(entityViewId.getId()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -149,7 +150,7 @@ public class EntityViewServiceImpl extends AbstractEntityService implements Enti |
|
|
return new TextPageData<>(entityViews, pageLink); |
|
|
return new TextPageData<>(entityViews, pageLink); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// @Cacheable(cacheNames = ENTITY_VIEW_CACHE, key = "{#tenantId, #entityId, #pageLink}")
|
|
|
@Cacheable(cacheNames = ENTITY_VIEW_CACHE) |
|
|
@Override |
|
|
@Override |
|
|
public TextPageData<EntityView> findEntityViewByTenantIdAndEntityId(TenantId tenantId, EntityId entityId, |
|
|
public TextPageData<EntityView> findEntityViewByTenantIdAndEntityId(TenantId tenantId, EntityId entityId, |
|
|
TextPageLink pageLink) { |
|
|
TextPageLink pageLink) { |
|
|
@ -189,7 +190,7 @@ public class EntityViewServiceImpl extends AbstractEntityService implements Enti |
|
|
return new TextPageData<>(entityViews, pageLink); |
|
|
return new TextPageData<>(entityViews, pageLink); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// @Cacheable(cacheNames = ENTITY_VIEW_CACHE, key = "{#tenantId, #customerId, #entityId, #pageLink}")
|
|
|
@Cacheable(cacheNames = ENTITY_VIEW_CACHE, key = "{#tenantId, #customerId, #entityId, #pageLink}") |
|
|
@Override |
|
|
@Override |
|
|
public TextPageData<EntityView> findEntityViewsByTenantIdAndCustomerIdAndEntityId(TenantId tenantId, |
|
|
public TextPageData<EntityView> findEntityViewsByTenantIdAndCustomerIdAndEntityId(TenantId tenantId, |
|
|
CustomerId customerId, |
|
|
CustomerId customerId, |
|
|
|