Class LogRepositoryImplementation<T extends EventLog>

java.lang.Object
io.github.tkasozi.repository.redis.LogRepositoryImplementation<T>
Type Parameters:
T - EventLog
All Implemented Interfaces:
LogRepository<T>

public class LogRepositoryImplementation<T extends EventLog> extends Object implements LogRepository<T>
Extra functionality.
  • Constructor Details

    • LogRepositoryImplementation

      public LogRepositoryImplementation(@NonNull @NonNull org.springframework.data.keyvalue.core.KeyValueOperations keyValueOperations, @NonNull @NonNull Class<T> clazz)
      Required args constructor.
      Parameters:
      keyValueOperations - For redis operations.
      clazz - For casting stored data.
  • Method Details

    • getAllSortedByDate

      public List<T> getAllSortedByDate()
      Sorts by date.
      Specified by:
      getAllSortedByDate in interface LogRepository<T extends EventLog>
      Returns:
      A list of sorted events.
    • getByTimeOffset

      public List<T> getByTimeOffset(Long timeOffset)
      Filters out events by timeOffset.
      Specified by:
      getByTimeOffset in interface LogRepository<T extends EventLog>
      Parameters:
      timeOffset - Cut off time.
      Returns:
      List of logs within the given offset.