StorageJetCache extends SimpleJpaRepository<E,PK> implements IStorage<PK,E> { @Override public E get(PK id) { Preconditions.checkNotNull(id,"id不能为null"); CacheGetResult<E> cacheGetResult = cache.GET(id); if (cacheGetResult.isSuccess()){ E entityFromCache = cacheGetResult.getValue(); return entityFromCache; }else { E entity = findOne(id); cache.put(id,entity); return entity; } } StorageJetCache(JpaEntityInformation<E, ?> entityInformation, EntityManager entityManager); @Override @Transactional(rollbackFor = Exception.class) E create(E entity); @Override @Transactional(rollbackFor = Exception.class) void update(E entity); @Override void mergeUpdate(E entity); @Override E get(PK id); @Override @Transactional(rollbackFor = Exception.class) E getOrCreate(PK id, EntityCreator<PK, E> entityCreator); @Override @Transactional(rollbackFor = Exception.class) E remove(PK id); void setDelay(int delay); void setProxy(IStorage<PK, E> proxy); void setCache(Cache<PK, E> cache);  }
@Test void get() { String account = "createNotExsist"; AccountEntity accountEntity = createNotExists(); Assertions.assertEquals(accountEntity,iStorage.get(account)); }