Package org.gridgain.internal.mcp.cache
Class SchemaCache
java.lang.Object
org.gridgain.internal.mcp.cache.SchemaCache
Manages caching of table schema definitions.
Uses Caffeine cache with:
- TTL-based expiration
- Maximum size limit with LRU eviction
- Automatic request coalescing for concurrent requests
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongReturns estimated number of entries in cache.Gets current cache statistics (for monitoring/debugging).com.github.benmanes.caffeine.cache.AsyncLoadingCache<String,McpResponse> Expose cache for testing purposes.Gets table schema from cache or loads it if not present.voidinvalidate(String tableName) Manually invalidates a cached schema entry.voidClears all cached schemas.protected CompletableFuture<McpResponse>loadSchemaInternal(String tableName) Internal load method - can be overridden in tests.
-
Constructor Details
-
SchemaCache
Caffeine cache builder.
-
-
Method Details
-
getSchema
Gets table schema from cache or loads it if not present.- Parameters:
tableName- the sanitized table name (already validated and uppercased)- Returns:
- CompletableFuture containing the schema response
-
invalidate
Manually invalidates a cached schema entry.- Parameters:
tableName- the table name to invalidate
-
invalidateAll
public void invalidateAll()Clears all cached schemas. -
getCacheStats
Gets current cache statistics (for monitoring/debugging). -
loadSchemaInternal
Internal load method - can be overridden in tests. Delegates to SchemaDiscovery for the actual schema lookup. -
getInternalCache
Expose cache for testing purposes. -
estimatedSize
public long estimatedSize()Returns estimated number of entries in cache. Useful for monitoring and invalidation feedback.
-