I was wondering if it's possible to use @Cacheable annotations on the spring data mongo repositories. For example like this:
public interface UserRepository extends MongoRepository<User, String> {
@Cacheable("byId")
public interface UserRepository extends MongoRepository<User, String> {
User findById(String id);
}
}
I'd like to do it on the interface class itself and avoid having a wrapper class if possible. In addition, is there a sample for how to do the cache config for redis with java config (not xml)?