#389 - Polishing.
Add author tags. Reformat code. Original pull request: #412.
This commit is contained in:
@@ -24,11 +24,12 @@ import org.springframework.data.repository.CrudRepository;
|
|||||||
*
|
*
|
||||||
* @author Oliver Gierke
|
* @author Oliver Gierke
|
||||||
* @author Thomas Darimont
|
* @author Thomas Darimont
|
||||||
|
* @author Andrea Rizzini
|
||||||
*/
|
*/
|
||||||
public interface CachingUserRepository extends CrudRepository<User, Long> {
|
public interface CachingUserRepository extends CrudRepository<User, Long> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@CacheEvict(value="byUsername", key="#p0.username")
|
@CacheEvict(value = "byUsername", key = "#p0.username")
|
||||||
<S extends User> S save(S entity);
|
<S extends User> S save(S entity);
|
||||||
|
|
||||||
@Cacheable("byUsername")
|
@Cacheable("byUsername")
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
*
|
*
|
||||||
* @author Oliver Gierke
|
* @author Oliver Gierke
|
||||||
* @author Thomas Darimont
|
* @author Thomas Darimont
|
||||||
|
* @author Andrea Rizzini
|
||||||
*/
|
*/
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@Transactional
|
@Transactional
|
||||||
@@ -56,13 +57,12 @@ public class CachingRepositoryTests {
|
|||||||
assertThat(cache.get("dmatthews").get()).isEqualTo(dave);
|
assertThat(cache.get("dmatthews").get()).isEqualTo(dave);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkCacheEviction() {
|
public void checkCacheEviction() {
|
||||||
|
|
||||||
User dave = new User();
|
User dave = new User();
|
||||||
dave.setUsername("dmatthews");
|
dave.setUsername("dmatthews");
|
||||||
dave = repository.save(dave);
|
repository.save(dave);
|
||||||
|
|
||||||
// Verify entity evicted on cache
|
// Verify entity evicted on cache
|
||||||
Cache cache = cacheManager.getCache("byUsername");
|
Cache cache = cacheManager.getCache("byUsername");
|
||||||
|
|||||||
Reference in New Issue
Block a user