Interface RecordSchemaCacheService

All Superinterfaces:
ConfigurableComponent, ControllerService

public interface RecordSchemaCacheService extends ControllerService
  • Field Details

  • Method Details

    • cacheSchema

      String cacheSchema(RecordSchema schema)
      Updates the cache to include the given Record Schema and returns an identifier for the Schema. If the schema already exists in the cache, the existing identifier is returned. Otherwise, the schema is added to the cache and a new identifier is created and returned. This identifier can then be used to retrieve the Record Schema via the getSchema(String) method
      Parameters:
      schema - the schema to cache
      Returns:
      a unique identifier for the schema
    • getSchema

      Optional<RecordSchema> getSchema(String schemaIdentifier)
      Returns the Schema with the given identifier, if it can be found in the cache. Note that the cache may choose to evict schemas for any number of reasons and, as such, the service may return an empty Optional even immediately after the Schema is cached via the cacheSchema(RecordSchema).
      Parameters:
      schemaIdentifier - the identifier of the schema
      Returns:
      an Optional holding the Record Schema with the given identifier, if it can be found, or an empty Optional if the schema cannot be found