@Test public void testSave() { Person p = new Person(1, "name1", 12, "address1"); personService.save(p); Person person = personService.findOne(p); Assert.assertEquals(person.getId(), 1); }
@Cacheable(value = "people" , key = "#person.id") @Override public Person save(Person person) { log.info("为id、key为:" + person.getId() + "数据做了缓存"); return person; }
PersonServiceImpl implements PersonService { @Cacheable(value = "people" , key = "#person.id") @Override public Person save(Person person) { log.info("为id、key为:" + person.getId() + "数据做了缓存"); return person; } }
PersonServiceImpl implements PersonService { @Cacheable(value = "people" , key = "#person.id") @Override public Person save(Person person) { log.info("为id、key为:" + person.getId() + "数据做了缓存"); return person; }  }
PersonServiceImpl implements PersonService { @Cacheable(value = "people" , key = "#person.id") @Override public Person save(Person person) { log.info("为id、key为:" + person.getId() + "数据做了缓存"); return person; }  @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 { @Cacheable(value = "people" , key = "#person.id") @Override public Person save(Person person) { log.info("为id、key为:" + person.getId() + "数据做了缓存"); return person; }  @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);  }