Interface DtoCache

All Known Implementing Classes:
DtoCacheImpl, NoOpDtoCache

public sealed interface DtoCache permits NoOpDtoCache, DtoCacheImpl
The DtoCache interface defines methods for caching Data Transfer Objects (DTOs). It provides functionality for retrieving and storing DTOs using their class type and an identifier. Implementations of this interface can manage caching strategies for efficient reuse of DTO instances.

This interface has the following key methods: - get(Class, List): Retrieves a cached DTO of the specified class type and identifier, or null if no matching DTO is found in the cache. - put(List, Object): Stores a new DTO in the cache associated with the provided identifier.

The interface is designed as a sealed interface with two implementations: - NoOpDtoCache: A no-operation implementation that does not perform any actual caching. - DtoCacheImpl: A concrete implementation that uses a Map-based caching mechanism.

  • Method Summary

    Modifier and Type
    Method
    Description
    <DTO> @Nullable DTO
    get(Class<DTO> dtoClass, List<Object> id)
     
    <DTO> @Nullable List<DTO>
    getAll(Class<DTO> dtoClass)
     
    void
    put(List<Object> id, @Nullable Object dto)
     
  • Method Details