Package io.sentry.cache
Class EnvelopeCache
java.lang.Object
io.sentry.cache.EnvelopeCache
- All Implemented Interfaces:
IEnvelopeCache,Iterable<SentryEnvelope>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprotected final @NotNull Filestatic final Stringprotected final @NotNull SentryOptionsstatic final Stringstatic final Stringprotected final @NotNull ISerializerstatic final Stringstatic final StringFile suffix added to all serialized envelopes files.protected static final Charset -
Constructor Summary
ConstructorsConstructorDescriptionEnvelopeCache(@NotNull SentryOptions options, @NotNull String cacheDirPath, int maxCacheItems) -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull IEnvelopeCachecreate(@NotNull SentryOptions options) voiddiscard(@NotNull SentryEnvelope envelope) voidstatic @NotNull FilegetCurrentSessionFile(@NotNull String cacheDirPath) static @NotNull FilegetPreviousSessionFile(@NotNull String cacheDirPath) protected booleanCheck if a dir.@NotNull Iterator<SentryEnvelope>iterator()protected voidrotateCacheIfNeeded(@NotNull File[] files) Rotates the caching folder if full, deleting the oldest files firstvoidstore(@NotNull SentryEnvelope envelope, @NotNull Hint hint) booleanAwaits until the previous session (if any) is flushed to its own file.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.sentry.cache.IEnvelopeCache
storeMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
SUFFIX_ENVELOPE_FILE
File suffix added to all serialized envelopes files.- See Also:
-
PREFIX_CURRENT_SESSION_FILE
- See Also:
-
PREFIX_PREVIOUS_SESSION_FILE
- See Also:
-
CRASH_MARKER_FILE
- See Also:
-
NATIVE_CRASH_MARKER_FILE
- See Also:
-
STARTUP_CRASH_MARKER_FILE
- See Also:
-
UTF_8
-
options
-
serializer
-
directory
-
-
Constructor Details
-
EnvelopeCache
public EnvelopeCache(@NotNull @NotNull SentryOptions options, @NotNull @NotNull String cacheDirPath, int maxCacheItems)
-
-
Method Details
-
create
-
store
- Specified by:
storein interfaceIEnvelopeCache
-
discard
- Specified by:
discardin interfaceIEnvelopeCache
-
getCurrentSessionFile
-
getPreviousSessionFile
-
iterator
- Specified by:
iteratorin interfaceIterable<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
Rotates the caching folder if full, deleting the oldest files first- Parameters:
files- the Files
-