Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
titleLookupFunctionProvider
/**
 * Provider for creating {@link LookupFunction} and {@link LookupCache} for storing lookup entries.
 */
@PublicEvolving
public classinterface PartialCachingLookupProvider extends LookupFunctionProvider {

    /**
    private final LookupFunction lookupFunction;
 * Build a {@link PartialCachingLookupProvider} from the specified {@link LookupFunction} and
     private* final{@link LookupCache cache;

}.
     */
    publicstatic PartialCachingLookupProvider of(LookupFunction lookupFunction, LookupCache cache) {
        this.lookupFunction = lookupFunction;
return new PartialCachingLookupProvider() {

         this.cache  = cache;@Override
    }

     @Override
    public LookupFunctionLookupCache createLookupFunctiongetCache() {
        return lookupFunction;
    }

	public LookupCache getCache() {
		return cache;
	}
}

AsyncPartialCachingLookupProvider

Code Block
languagejava
titleLookupFunctionProvider
/**
 * Provider for creating {@link AsyncLookupFunction} and {@link LookupCache} for storing lookup entries.
 */
@PublicEvolving
public class AsyncPartialCachingLookupProvider extends AsyncLookupFunctionProvider { 
 }

          private final AsyncLookupFunction@Override
 asyncLookupFunction;
    private final LookupCache cache;

    public AsyncPartialCachingLookupProvider(AsyncLookupFunction asyncLookupFunction, LookupCache cacheLookupFunction createLookupFunction() {
        this.asyncLookupFunction = asyncLookupFunction;
        this.cache =return cachelookupFunction;
    }

    @Override
    public AsyncLookupFunction createAsyncLookupFunction() {}
        return asyncLookupFunction};
    }

    public/** LookupCacheGet getCache() {
     a new instance of {@link LookupCache}. */
    returnLookupCache cachegetCache();
    }
}

FullCachingLookupProvider

This interface is for supporting full cache strategy. It reuses ScanRuntimeProvider and defines reload time. 

PartialCachingAsyncLookupProvider

Code Block
languagejava
titleFullCachingLookupProviderLookupFunctionProvider
/**
 * Provider for Acreating {@link LookupFunctionProviderAsyncLookupFunction} and {@link LookupCache} for storing lookup entries.
 */
@PublicEvolving
public interface PartialCachingAsyncLookupProvider extends AsyncLookupFunctionProvider {

    /**
     * Build a {@link PartialCachingLookupProvider} from the specified {@link AsyncLookupFunction} and
     * {@link LookupCache}.
     */
    static PartialCachingLookupProvider of(AsyncLookupFunction asyncLookupFunction, LookupCache cache) {
        return new PartialCachingAsyncLookupProvider() {

            @Override
            public LookupCache getCache() {
                return cache;
            }

            @Override
            public AsyncLookupFunction createAsyncLookupFunction() {
                return asyncLookupFunction;
            }
        };
    }

    /** Get a new instance of {@link LookupCache}. */
    LookupCache getCache();
}

FullCachingLookupProvider

This interface is for supporting full cache strategy. It reuses ScanRuntimeProvider and defines reload time. 

Code Block
languagejava
titleFullCachingLookupProvider
/**
 * A {@link CachingLookupProvider} 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(
            ScanTableSource.ScanRuntimeProvider scanRuntimeProvider,
            CacheReloadTrigger cacheReloadTrigger) {
        return new FullCachingLookupProvider() {
            @Override
            public ScanTableSource.ScanRuntimeProvider getScanRuntimeProvider() {
                return scanRuntimeProvider;
            }

            @Overridethat 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 and reload operations will be triggered by the {@link CacheReloadTrigger}.
 */
@PublicEvolving
public class FullCachingLookupProvider implements LookupFunctionProvider {

    private final ScanTableSource.ScanRuntimeProvider scanRuntimeProvider;
    private final CacheReloadTrigger reloadTrigger;

    public FullCachingLookupProvider(
            ScanTableSource.ScanRuntimeProvider scanRuntimeProvider,public CacheReloadTrigger getCacheReloadTrigger() {
            CacheReloadTrigger reloadTrigger) {
    return cacheReloadTrigger;
         this.scanRuntimeProvider  = scanRuntimeProvider;}

         this.reloadTrigger  = reloadTrigger;@Override
    }

    @Override
    public LookupFunction createLookupFunction() {
                return (keyRow) -> null;
            }
        };
    }

	public    ScanTableSource.ScanRuntimeProvider getScanRuntimeProvider() {
		return scanRuntimeProvider;;

    }

	public CacheReloadTrigger getCacheReloadTrigger() {
		return reloadTrigger;
	}
}  

CacheReloadTrigger

A trigger defining custom logic for triggering full cache reloading.

...