Package org.apache.calcite.schema.lookup
Class LoadingCacheLookup<T>
java.lang.Object
org.apache.calcite.schema.lookup.LoadingCacheLookup<T>
- Type Parameters:
T
- Element Type
- All Implemented Interfaces:
Lookup<T>
This class is using a
LoadingCache
to speed up lookups,
delegated to another Lookup
instance.
This class is thread safe. All entries are evicted after one minute.
Negative matches are never cached. If a new entry
becomes available in the associated Lookup
, it's immediately
visible outside. If an entry is deleted in the associated Lookup
,
it takes one minute until it disappears if it was cached in the last minute.
Otherwise, it disappears immediately.
-
Constructor Summary
ConstructorsConstructorDescriptionLoadingCacheLookup
(Lookup<T> delegate) Creates aLookup
object with a `LoadingCache`inside.LoadingCacheLookup
(Lookup<T> delegate, Duration expiration) Creates aLookup
object with a `LoadingCache`inside. -
Method Summary
Modifier and TypeMethodDescription@Nullable T
Returns a named entity with a given name, or null if not found.getIgnoreCase
(String name) Returns a named entity with a given name ignoring the case, or null if not found.getNames
(LikePattern pattern) Returns the names of the entities in matching pattern.
-
Constructor Details
-
LoadingCacheLookup
Creates aLookup
object with a `LoadingCache`inside.- Parameters:
delegate
- TheLookup
object, which should be cachedexpiration
- The duration after which the entries are evicted from the loading cache.
-
LoadingCacheLookup
Creates aLookup
object with a `LoadingCache`inside.The expiration is set to 1 minute.
- Parameters:
delegate
- TheLookup
object, which should be cached
-
-
Method Details
-
get
Description copied from interface:Lookup
Returns a named entity with a given name, or null if not found. -
getIgnoreCase
Description copied from interface:Lookup
Returns a named entity with a given name ignoring the case, or null if not found.- Specified by:
getIgnoreCase
in interfaceLookup<T>
- Parameters:
name
- Name- Returns:
- Entity with the specified name (case insensitive), or null when the entity is not found.
-
getNames
Description copied from interface:Lookup
Returns the names of the entities in matching pattern. The search is always case sensitive. This is caused by the fact thatDatabaseMetaData.getTables(...)
doesn't support case insensitive lookups.
-