Showing
1 changed file
with
6 additions
and
5 deletions
... | ... | @@ -24,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
24 | 24 | import org.springframework.cache.Cache; |
25 | 25 | import org.springframework.cache.CacheManager; |
26 | 26 | import org.springframework.cache.annotation.CacheEvict; |
27 | +import org.springframework.cache.annotation.CachePut; | |
27 | 28 | import org.springframework.cache.annotation.Cacheable; |
28 | 29 | import org.springframework.stereotype.Service; |
29 | 30 | import org.thingsboard.server.common.data.Customer; |
... | ... | @@ -88,7 +89,7 @@ public class EntityViewServiceImpl extends AbstractEntityService implements Enti |
88 | 89 | @Autowired |
89 | 90 | private CacheManager cacheManager; |
90 | 91 | |
91 | -// @Cacheable(cacheNames = ENTITY_VIEW_CACHE, key = "{#entityViewId}") | |
92 | + @Cacheable(cacheNames = ENTITY_VIEW_CACHE) | |
92 | 93 | @Override |
93 | 94 | public EntityView findEntityViewById(EntityViewId entityViewId) { |
94 | 95 | log.trace("Executing findEntityViewById [{}]", entityViewId); |
... | ... | @@ -104,7 +105,7 @@ public class EntityViewServiceImpl extends AbstractEntityService implements Enti |
104 | 105 | .orElse(null); |
105 | 106 | } |
106 | 107 | |
107 | -// @CacheEvict(cacheNames = ENTITY_VIEW_CACHE, key = "{#entityView.id}") | |
108 | + @CachePut(cacheNames = ENTITY_VIEW_CACHE) | |
108 | 109 | @Override |
109 | 110 | public EntityView saveEntityView(EntityView entityView) { |
110 | 111 | log.trace("Executing save entity view [{}]", entityView); |
... | ... | @@ -136,7 +137,7 @@ public class EntityViewServiceImpl extends AbstractEntityService implements Enti |
136 | 137 | List<Object> list = new ArrayList<>(); |
137 | 138 | list.add(entityView.getTenantId()); |
138 | 139 | list.add(entityView.getName()); |
139 | -// cache.evict(list); | |
140 | + cache.evict(list); | |
140 | 141 | entityViewDao.removeById(entityViewId.getId()); |
141 | 142 | } |
142 | 143 | |
... | ... | @@ -149,7 +150,7 @@ public class EntityViewServiceImpl extends AbstractEntityService implements Enti |
149 | 150 | return new TextPageData<>(entityViews, pageLink); |
150 | 151 | } |
151 | 152 | |
152 | -// @Cacheable(cacheNames = ENTITY_VIEW_CACHE, key = "{#tenantId, #entityId, #pageLink}") | |
153 | + @Cacheable(cacheNames = ENTITY_VIEW_CACHE) | |
153 | 154 | @Override |
154 | 155 | public TextPageData<EntityView> findEntityViewByTenantIdAndEntityId(TenantId tenantId, EntityId entityId, |
155 | 156 | TextPageLink pageLink) { |
... | ... | @@ -189,7 +190,7 @@ public class EntityViewServiceImpl extends AbstractEntityService implements Enti |
189 | 190 | return new TextPageData<>(entityViews, pageLink); |
190 | 191 | } |
191 | 192 | |
192 | -// @Cacheable(cacheNames = ENTITY_VIEW_CACHE, key = "{#tenantId, #customerId, #entityId, #pageLink}") | |
193 | + @Cacheable(cacheNames = ENTITY_VIEW_CACHE, key = "{#tenantId, #customerId, #entityId, #pageLink}") | |
193 | 194 | @Override |
194 | 195 | public TextPageData<EntityView> findEntityViewsByTenantIdAndCustomerIdAndEntityId(TenantId tenantId, |
195 | 196 | CustomerId customerId, | ... | ... |