#389 - Polishing.

Add author tags. Reformat code.

Original pull request: #412.
This commit is contained in:
Mark Paluch
2018-09-19 15:49:25 +02:00
parent 2828e352fa
commit 02ee909aa7
2 changed files with 4 additions and 3 deletions

View File

@@ -24,11 +24,12 @@ import org.springframework.data.repository.CrudRepository;
*
* @author Oliver Gierke
* @author Thomas Darimont
* @author Andrea Rizzini
*/
public interface CachingUserRepository extends CrudRepository<User, Long> {
@Override
@CacheEvict(value="byUsername", key="#p0.username")
@CacheEvict(value = "byUsername", key = "#p0.username")
<S extends User> S save(S entity);
@Cacheable("byUsername")

View File

@@ -32,6 +32,7 @@ import org.springframework.transaction.annotation.Transactional;
*
* @author Oliver Gierke
* @author Thomas Darimont
* @author Andrea Rizzini
*/
@RunWith(SpringRunner.class)
@Transactional
@@ -56,13 +57,12 @@ public class CachingRepositoryTests {
assertThat(cache.get("dmatthews").get()).isEqualTo(dave);
}
@Test
public void checkCacheEviction() {
User dave = new User();
dave.setUsername("dmatthews");
dave = repository.save(dave);
repository.save(dave);
// Verify entity evicted on cache
Cache cache = cacheManager.getCache("byUsername");