PatrickRen commented on code in PR #20382: URL: https://github.com/apache/flink/pull/20382#discussion_r937426239
########## flink-table/flink-table-common/src/main/java/org/apache/flink/table/connector/source/lookup/FullCachingLookupProvider.java: ########## @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.table.connector.source.lookup; + +import org.apache.flink.annotation.PublicEvolving; +import org.apache.flink.table.connector.source.ScanTableSource; +import org.apache.flink.table.connector.source.lookup.cache.trigger.CacheReloadTrigger; +import org.apache.flink.table.functions.LookupFunction; + +/** + * A {@link LookupFunctionProvider} that never lookup in external system on cache miss and provides + * a cache for holding all entries in the external system. The cache will be fully reloaded from the + * external system by the {@link ScanTableSource.ScanRuntimeProvider} and reload operations will be + * triggered by the {@link CacheReloadTrigger}. + */ +@PublicEvolving +public interface FullCachingLookupProvider extends LookupFunctionProvider { + static FullCachingLookupProvider of( Review Comment: Missing JavaDoc for this public API method ########## flink-table/flink-table-common/src/main/java/org/apache/flink/table/connector/source/lookup/cache/trigger/PeriodicCacheReloadTrigger.java: ########## @@ -0,0 +1,135 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.table.connector.source.lookup.cache.trigger; + +import org.apache.flink.annotation.VisibleForTesting; +import org.apache.flink.configuration.ReadableConfig; + +import java.time.Duration; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + +import static org.apache.flink.table.connector.source.lookup.LookupOptions.CACHE_TYPE; +import static org.apache.flink.table.connector.source.lookup.LookupOptions.FULL_CACHE_PERIODIC_RELOAD_INTERVAL; +import static org.apache.flink.table.connector.source.lookup.LookupOptions.FULL_CACHE_PERIODIC_RELOAD_SCHEDULE_MODE; +import static org.apache.flink.table.connector.source.lookup.LookupOptions.FULL_CACHE_RELOAD_STRATEGY; +import static org.apache.flink.table.connector.source.lookup.LookupOptions.LookupCacheType.FULL; +import static org.apache.flink.table.connector.source.lookup.LookupOptions.ReloadStrategy.PERIODIC; +import static org.apache.flink.util.Preconditions.checkArgument; + +/** + * A trigger that reloads cache entries periodically with specified interval and {@link + * ScheduleMode}. If {@code reloadInterval} is zero, cache loading will happen just one time. Review Comment: I think this JavaDoc should be updated as the argument check in the constructor has disabled the possibility of using zero as the reload interval. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
