Keyed by BibEntry reference identity (using IdentityHashMap), so it
works even for entries that have no citation key or a non-unique one.
On close(), entries whose BibEntry has a present and unique
citation key and a valid AI library ID are flushed to the persistent SummariesRepository.
Thread-safe: all map operations are protected by a synchronized wrapper.
| Modifier and Type | Class and Description |
|---|---|
| private static record |
| Modifier and Type | Field and Description |
|---|---|
| private final Map | |
| private final SummariesRepository |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | close()
Writes all cached summaries to the persistent repository for entries whose citation key is present and unique and whose database has a valid AI library ID. Entries that do not satisfy both conditions are silently skipped. |
| public Optional | |
| public void | |
| public void |
| cache | back to summary |
|---|---|
| private final Map<BibEntry, InMemorySummaryCache. | |
| repository | back to summary |
|---|---|
| private final SummariesRepository repository | |
| InMemorySummaryCache | back to summary |
|---|---|
| public InMemorySummaryCache(SummariesRepository repository) | |
| close | back to summary |
|---|---|
| public void close() Writes all cached summaries to the persistent repository for entries whose citation key is present and unique and whose database has a valid AI library ID. Entries that do not satisfy both conditions are silently skipped. Call this when the library or application is closing so that valid summaries survive the next restart. | |
| get | back to summary |
|---|---|
| public Optional Returns the cached summary for | |
| put | back to summary |
|---|---|
| public void put(FullBibEntry fullEntry, AiSummary summary) Stores | |
| remove | back to summary |
|---|---|
| public void remove(BibEntry entry) Removes the cached summary for | |
| Modifier and Type | Field and Description |
|---|---|
| private final FullBibEntry | fullEntry
Record Component accessed by fullEntry(). |
| private final AiSummary |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public final boolean | equals(Object o)
Implements abstract java. Indicates whether some other object is "equal to" this one. |
| public FullBibEntry | |
| public final int | |
| public AiSummary | |
| public final String | toString()
Implements abstract java. Returns a string representation of the record. |
| fullEntry | back to summary |
|---|---|
| private final FullBibEntry fullEntry Record Component accessed by fullEntry(). | |
| summary | back to summary |
|---|---|
| private final AiSummary summary Record Component accessed by summary(). | |
| CachedEntry | back to summary |
|---|---|
| private CachedEntry(AiSummary summary, FullBibEntry fullEntry) | |
| equals | back to summary |
|---|---|
| public final boolean equals(Object o) Implements abstract java. Doc from java. Indicates whether some other object is "equal to" this one. In addition
to the general contract of
R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
| |
| fullEntry | back to summary |
|---|---|
| public FullBibEntry fullEntry() Record Component getter of fullEntry. | |
| hashCode | back to summary |
|---|---|
| public final int hashCode() Implements abstract java. Doc from java. Returns a hash code value for the record.
Obeys the general contract of | |
| summary | back to summary |
|---|---|
| public AiSummary summary() Record Component getter of summary. | |
| toString | back to summary |
|---|---|
| public final String toString() Implements abstract java. Doc from java. Returns a string representation of the record.
In accordance with the general contract of In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves. | |