KmemoAutoConfiguration
Auto-configures a SemanticCache bean the moment an Embedder bean is present.
kmemo ships no embedder — you bring one (OpenAI, a local ONNX model, whatever) as a Spring bean, and this wires the cache around it, reading the KmemoProperties under kmemo.*. Everything is conditional and overridable:
The store defaults to InMemoryStore. Define your own CacheStore bean — a Redis or pgvector adapter, say — and it is used instead (
@ConditionalOnMissingBean).A Verifier bean, if you define one, is attached; multiple CacheListener beans (metrics, logging) are all attached, in
@Order.Define your own SemanticCache bean and this backs off entirely.
@Bean fun embedder(client: OpenAiClient) = Embedder { text -> client.embed(text) }
// …and a SemanticCache bean is now available to inject anywhere.Functions
The default store, used unless the application defines its own CacheStore bean.
The cache itself: built only when an Embedder is available and no SemanticCache bean exists.