class StorageJetCache extends SimpleJpaRepository<E,PK> implements IStorage<PK,E> {

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void update(E entity) {
        PK id = entity.getId();
        Preconditions.checkNotNull(id,"id不能为null");
        CacheGetResult<E> cacheGetResult = cache.GET(id);
        if (cacheGetResult.isSuccess()){
            E entityFromCache = cacheGetResult.getValue();
            // 缓存中缓存了其null值，说明数据库中没有
            if (entityFromCache == null) {
                throw new EntityNotFoundException("数据库中不存在该实体，先create一下？");
            }
            // 缓存中有，说明数据库中也有
            else {
                executeUpdate(entity);
            }
        }else {
            if (exists(entity.getId())){
                executeUpdate(entity);
            }else {
                throw new EntityNotFoundException("数据库中不存在该实体，先create一下？");
            }
        }
    }

}

class StorageJetCacheTest extends SimpleJpaRepository<E,PK> {

    private static final Logger logger;
    @Autowired IStorage<String, AccountEntity> iStorage;
    @Autowired
    private IStorage<Long, ContainerEntity> containerEntityIStorage;
    @Test void entity;
     Container packContainer;
     entity.getType2ContainerMap().put PACK;
     containerEntityIStorage.create entity;
     containerEntityIStorage.update entity;

    @Test
    void update() {

        AccountEntity accountEntity = createNotExists();
        accountEntity.setPassword("passWordUpdate");
        iStorage.update(accountEntity);
        iStorage.remove(accountEntity.getId());
        Assertions.assertEquals("passWordUpdate",iStorage.get(accountEntity.getAccount()).getPassword());
    }

}