Class EnvelopeCache

java.lang.Object
io.sentry.cache.EnvelopeCache
All Implemented Interfaces:
IEnvelopeCache, Iterable<SentryEnvelope>

@Internal public class EnvelopeCache extends Object implements IEnvelopeCache
  • Field Details

  • Constructor Details

    • EnvelopeCache

      public EnvelopeCache(@NotNull @NotNull SentryOptions options, @NotNull @NotNull String cacheDirPath, int maxCacheItems)
  • Method Details

    • create

      @NotNull public static @NotNull IEnvelopeCache create(@NotNull @NotNull SentryOptions options)
    • store

      public void store(@NotNull @NotNull SentryEnvelope envelope, @NotNull @NotNull Hint hint)
      Specified by:
      store in interface IEnvelopeCache
    • discard

      public void discard(@NotNull @NotNull SentryEnvelope envelope)
      Specified by:
      discard in interface IEnvelopeCache
    • getCurrentSessionFile

      @NotNull public static @NotNull File getCurrentSessionFile(@NotNull @NotNull String cacheDirPath)
    • getPreviousSessionFile

      @NotNull public static @NotNull File getPreviousSessionFile(@NotNull @NotNull String cacheDirPath)
    • iterator

      @NotNull public @NotNull Iterator<SentryEnvelope> iterator()
      Specified by:
      iterator in interface Iterable<SentryEnvelope>
    • waitPreviousSessionFlush

      public boolean waitPreviousSessionFlush()
      Awaits until the previous session (if any) is flushed to its own file.
    • flushPreviousSession

      public void flushPreviousSession()
    • isDirectoryValid

      protected boolean isDirectoryValid()
      Check if a dir. is valid and have write and read permission
      Returns:
      true if valid and has permissions or false otherwise
    • rotateCacheIfNeeded

      protected void rotateCacheIfNeeded(@NotNull @NotNull File[] files)
      Rotates the caching folder if full, deleting the oldest files first
      Parameters:
      files - the Files