code: private CacheLoader<Object, Optional<Map<String, Object>>> createCacheLoader(
        final Repository<Entity> repository) {
      return new CacheLoader<Object, Optional<Map<String, Object>>>() {
        /**
         * Loads a single entity from the repository.
         *
         * @param id ID value of the entity to retrieve
         * @return dehydrated entity or empty if the entity was not present in the repository
         */
        @Override
        public Optional<Map<String, Object>> load(@Nonnull Object id) {
          return Optional.ofNullable(repository.findOneById(id)).map(entityHydration::dehydrate);
        }
  
        /**
         * Loads multiple entities from the repository.
         *
         * @param ids Iterable of String representations of the ID values
         * @return Map mapping id to loaded entity, or to empty optional if the entity was not present
         *     in the repository
         */
        @Override
        public Map<Object, Optional<Map<String, Object>>> loadAll(Iterable<?> ids) {
          Stream<Object> typedIds = stream(ids).map(id -> id);
          Map<Object, Optional<Map<String, Object>>> result =
              repository.findAll(typedIds).collect(toMap(Entity::getIdValue, this::dehydrateEntity));
          for (Object key : ids) {
            // cache the absence of these entities in the backend as empty values
            result.putIfAbsent(key, empty());
          }
          return result;
        }
  
        private Optional<Map<String, Object>> dehydrateEntity(Entity entity) {
          return Optional.of(entityHydration.dehydrate(entity));
        }
      };
    }
docs: Creates a CacheLoader that loads entities from the repository and dehydrates them.
  
  @param repository the Repository to load the entities from
  @return the {@link CacheLoader}