@Test public void testRemove() { Person p = new Person(5, "name1", 12, "address1"); personService.save(p); log.info("缓存中一个缓存 id = 5 的 Person 对象"); personService.remove(5L); log.info("删除一个缓存 id = 5 的 Person 对象"); Person person = personService.findOne(p); log.info("从数据库中抓取一个 id = 2 的对象，并存入缓存"); Assert.assertEquals(person.getId(), 2); }
@CacheEvict(value = "people", key = "#id") @Override public void remove(Long id) { log.info("删除了id、key为" + id + "的数据缓存"); }
PersonServiceImpl implements PersonService { @CacheEvict(value = "people", key = "#id") @Override public void remove(Long id) { log.info("删除了id、key为" + id + "的数据缓存"); } }
PersonServiceImpl implements PersonService { @CacheEvict(value = "people", key = "#id") @Override public void remove(Long id) { log.info("删除了id、key为" + id + "的数据缓存"); }  }
PersonServiceImpl implements PersonService { @CacheEvict(value = "people", key = "#id") @Override public void remove(Long id) { log.info("删除了id、key为" + id + "的数据缓存"); }  @Cacheable(value = "people" , key = "#person.id") @Override Person save(Person person); @CacheEvict(value = "people", key = "#id") @Override void remove(Long id); @CacheEvict(value = "people", allEntries = true) @Override void removeAll(); @Cacheable(value = "people", key = "#person.id", firstCache = @FirstCache(expireTime = 4), secondaryCache = @SecondaryCache(expireTime = 5, preloadTime = 1, forceRefresh = true)) @Override Person findOne(Person person); }
PersonServiceImpl implements PersonService { @CacheEvict(value = "people", key = "#id") @Override public void remove(Long id) { log.info("删除了id、key为" + id + "的数据缓存"); }  @Cacheable(value = "people" , key = "#person.id") @Override Person save(Person person); @CacheEvict(value = "people", key = "#id") @Override void remove(Long id); @CacheEvict(value = "people", allEntries = true) @Override void removeAll(); @Cacheable(value = "people", key = "#person.id", firstCache = @FirstCache(expireTime = 4), secondaryCache = @SecondaryCache(expireTime = 5, preloadTime = 1, forceRefresh = true)) @Override Person findOne(Person person);  }