Two complementary maps:
/lookup (or batched /lookup:batch) skip the LLM / fetcher parse
entirely when the same citation string has been parsed recently (e.g.
SumatraPDF re-scans a visible PDF page after the user jumps back to it).
Longer TTL than the token cache because the parsed BibEntry stays valid
as long as the citation text does.
| Modifier and Type | Class and Description |
|---|---|
| public static record |
| Modifier and Type | Field and Description |
|---|---|
| private static final int | CUID_LENGTH
Token length picked to match the CUID2 size already used by
|
| private static final int | |
| private static final Duration | |
| private final Cache | |
| private static final int | |
| private static final Duration | |
| private final Cache |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Optional | |
| public Optional | |
| public void | invalidate(String key)
Drops the cache entry; called by the add endpoint after a successful import so a stale token can't be re-used to add a duplicate. |
| public String | |
| public void |
| CUID_LENGTH | back to summary |
|---|---|
| private static final int CUID_LENGTH Token length picked to match the CUID2 size already used by
| |
| TEXT_MAX_ENTRIES | back to summary |
|---|---|
| private static final int TEXT_MAX_ENTRIES | |
| TEXT_TTL | back to summary |
|---|---|
| private static final Duration TEXT_TTL | |
| textCache | back to summary |
|---|---|
| private final Cache<String, CitationCacheService. | |
| TOKEN_MAX_ENTRIES | back to summary |
|---|---|
| private static final int TOKEN_MAX_ENTRIES | |
| TOKEN_TTL | back to summary |
|---|---|
| private static final Duration TOKEN_TTL | |
| tokenCache | back to summary |
|---|---|
| private final Cache<String, CitationCacheService. | |
| CitationCacheService | back to summary |
|---|---|
| public CitationCacheService() | |
| get | back to summary |
|---|---|
| public Optional Returns the cached citation, or empty when the token has expired or was never issued. Does not evict on read so the same lookup result can be added more than once (idempotent across retries). | |
| getByText | back to summary |
|---|---|
| public Optional Returns the cached parse for the given citation text, or empty on miss. | |
| invalidate | back to summary |
|---|---|
| public void invalidate(String key) Drops the cache entry; called by the add endpoint after a successful import so a stale token can't be re-used to add a duplicate. | |
| put | back to summary |
|---|---|
| public String put(BibEntry parsed, String rawCitation) Stores a parsed citation and returns the token the client should send back to the add endpoint. | |
| putByText | back to summary |
|---|---|
| public void putByText(BibEntry parsed, String rawCitation) Stashes a parsed citation under its raw text so a later | |
| Modifier and Type | Field and Description |
|---|---|
| private final Instant | createdAt
Record Component accessed by createdAt(). |
| private final BibEntry | |
| private final String | rawCitation
Record Component accessed by rawCitation(). |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Instant | |
| public final boolean | equals(Object o)
Implements abstract java. Indicates whether some other object is "equal to" this one. |
| public final int | |
| public BibEntry | |
| public String | |
| public final String | toString()
Implements abstract java. Returns a string representation of the record. |
| createdAt | back to summary |
|---|---|
| private final Instant createdAt Record Component accessed by createdAt(). | |
| parsed | back to summary |
|---|---|
| private final BibEntry parsed Record Component accessed by parsed(). | |
| rawCitation | back to summary |
|---|---|
| private final String rawCitation Record Component accessed by rawCitation(). | |
| CachedCitation | back to summary |
|---|---|
| public CachedCitation(BibEntry parsed, String rawCitation, Instant createdAt) | |
| createdAt | back to summary |
|---|---|
| public Instant createdAt() Record Component getter of createdAt. | |
| 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).
| |
| 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 | |
| parsed | back to summary |
|---|---|
| public BibEntry parsed() Record Component getter of parsed. | |
| rawCitation | back to summary |
|---|---|
| public String rawCitation() Record Component getter of rawCitation. | |
| 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. | |