content: package io.activej.codegen;
  
  import io.activej.common.annotation.ComponentInterface;
  
  import java.util.Optional;
  
  /**
   * Defines a persistent bytecode storage. This storage allows loading previously generated bytecode
   * on application restarts, avoiding possible costly class generation.
   */
  @ComponentInterface
  public interface IBytecodeStorage {
  	/**
  	 * Tries to load a bytecode from the persistent storage by a class name.
  	 * <p>
  	 * Implementations should ignore any exceptions that may occur when trying to load a bytecode.
  	 * If such exceptions occur, implementations may log the exception, returning {@link Optional#empty()}
  	 * as if there is no bytecode cached for a given class name.
  	 *
  	 * @param className a name of the class
  	 * @return a byte array that represents a bytecode
  	 */
  	Optional<byte[]> loadBytecode(String className);
  
  	/**
  	 * Tries to save a bytecode to the persistent storage.
  	 * <p>
  	 * Implementations should ignore any exceptions that may occur when trying to save a bytecode.
  	 * If such exceptions occur, implementations may log the exception, returning from the method.
  	 *
  	 * @param className a name of the class
  	 * @param bytecode  a bytecode to be saved
  	 */
  	void saveBytecode(String className, byte[] bytecode);
  }
  