public class PromptCache extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
PromptCache.PromptCacheConfig
Configuration for prompt cache.
|
| Constructor and Description |
|---|
PromptCache(PromptCache.PromptCacheConfig config,
Function<String,Prompt> loader)
Create a PromptCache with custom configuration.
|
| Modifier and Type | Method and Description |
|---|---|
CompletableFuture<Prompt> |
get(String key)
Get prompt from cache, loading if necessary.
|
Prompt |
getSync(String key)
Get prompt from cache synchronously.
|
void |
invalidate(String key)
Invalidate a cache entry.
|
void |
invalidateAll()
Invalidate all cache entries.
|
void |
put(String key,
Prompt prompt)
Put prompt into cache.
|
com.github.benmanes.caffeine.cache.stats.CacheStats |
stats()
Get cache statistics.
|
public PromptCache(PromptCache.PromptCacheConfig config, Function<String,Prompt> loader)
config - cache configurationloader - function to load prompt when not in cachepublic CompletableFuture<Prompt> get(String key)
key - the cache keypublic Prompt getSync(String key)
key - the cache keypublic void put(String key, Prompt prompt)
key - the cache keyprompt - the promptpublic void invalidate(String key)
key - the cache keypublic void invalidateAll()
public com.github.benmanes.caffeine.cache.stats.CacheStats stats()
Copyright © 2026. All rights reserved.