use of com.xiaolyuh.entity.Person in project spring-boot-student by wyh-spring-ecosystem-student.
the class PersonServiceImpl method findOne.
/**
* Cacheable
* value:缓存key的前缀。
* key:缓存key的后缀。
* sync:设置如果缓存过期是不是只放一个请求去请求数据库,其他请求阻塞,默认是false。
*/
@Override
@Cacheable(value = "people#${select.cache.timeout:1800}#${select.cache.refresh:600}", key = "#person.id", sync = true)
public // 3
Person findOne(Person person, String a, String[] b, List<Long> c) {
Person p = personRepository.findOne(person.getId());
System.out.println("为id、key为:" + p.getId() + "数据做了缓存");
System.out.println(redisTemplate);
return p;
}
Aggregations