Class SchemaCache

java.lang.Object
org.gridgain.internal.mcp.cache.SchemaCache

public class SchemaCache extends Object
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 Details

  • Method Details

    • getSchema

      public CompletableFuture<McpResponse> getSchema(String tableName)
      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

      public void invalidate(String tableName)
      Manually invalidates a cached schema entry.
      Parameters:
      tableName - the table name to invalidate
    • invalidateAll

      public void invalidateAll()
      Clears all cached schemas.
    • getCacheStats

      public String getCacheStats()
      Gets current cache statistics (for monitoring/debugging).
    • loadSchemaInternal

      protected CompletableFuture<McpResponse> loadSchemaInternal(String tableName)
      Internal load method - can be overridden in tests. Delegates to SchemaDiscovery for the actual schema lookup.
    • getInternalCache

      public com.github.benmanes.caffeine.cache.AsyncLoadingCache<String,McpResponse> getInternalCache()
      Expose cache for testing purposes.
    • estimatedSize

      public long estimatedSize()
      Returns estimated number of entries in cache. Useful for monitoring and invalidation feedback.