package com.didispace.domain; import org.springframework.cache.annotation.CacheConfig; import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.CachePut; import org.springframework.cache.annotation.Cacheable; import org.springframework.data.jpa.repository.JpaRepository; /** * @author 程序猿DD * @version 1.0.0 * @date 16/3/23 下午2:34. * @blog http://blog.didispace.com */ @CacheConfig(cacheNames = "users") public interface UserRepository extends JpaRepository<User, Long> { @Cacheable(key = "#p0", condition = "#p0.length() < 10") User findByName(String name); }