File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed
main/java/example/springdata/jpa/caching
test/java/example/springdata/jpa/caching Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change 24
24
*
25
25
* @author Oliver Gierke
26
26
* @author Thomas Darimont
27
+ * @author Andrea Rizzini
27
28
*/
28
29
public interface CachingUserRepository extends CrudRepository <User , Long > {
29
30
30
31
@ Override
31
- @ CacheEvict (value = "byUsername" , key = "#p0.username" )
32
+ @ CacheEvict (value = "byUsername" , key = "#p0.username" )
32
33
<S extends User > S save (S entity );
33
34
34
35
@ Cacheable ("byUsername" )
Original file line number Diff line number Diff line change 32
32
*
33
33
* @author Oliver Gierke
34
34
* @author Thomas Darimont
35
+ * @author Andrea Rizzini
35
36
*/
36
37
@ RunWith (SpringRunner .class )
37
38
@ Transactional
@@ -56,13 +57,12 @@ public void checkCachedValue() {
56
57
assertThat (cache .get ("dmatthews" ).get ()).isEqualTo (dave );
57
58
}
58
59
59
-
60
60
@ Test
61
61
public void checkCacheEviction () {
62
62
63
63
User dave = new User ();
64
64
dave .setUsername ("dmatthews" );
65
- dave = repository .save (dave );
65
+ repository .save (dave );
66
66
67
67
// Verify entity evicted on cache
68
68
Cache cache = cacheManager .getCache ("byUsername" );
You can’t perform that action at this time.
0 commit comments