public final class TypeServiceImpl extends java.lang.Object implements TypeService
| Constructor and Description |
|---|
TypeServiceImpl(BaseSyncOptions syncOptions) |
| Modifier and Type | Method and Description |
|---|---|
java.util.concurrent.CompletionStage<java.util.Optional<java.lang.String>> |
fetchCachedTypeId(java.lang.String key)
Given a
key, this method first checks if a cached map of Type keys -> ids is not empty. |
void |
invalidateCache()
Invalidates the state of the cache so that on the next fetch a fresh copy is fetched and cached.
|
public TypeServiceImpl(@Nonnull
BaseSyncOptions syncOptions)
@Nonnull
public java.util.concurrent.CompletionStage<java.util.Optional<java.lang.String>> fetchCachedTypeId(@Nonnull
java.lang.String key)
TypeServicekey, this method first checks if a cached map of Type keys -> ids is not empty.
If not, it returns a completed future that contains an optional that contains what this key maps to in
the cache. If the cache is empty, the method populates the cache with the mapping of all Type keys to ids in
the CTP project, by querying the CTP project for all Types.
After that, the method returns a CompletionStage<Optional<String>>
in which the result of it's completion could contain an
Optional with the id inside of it or an empty Optional if no Channel was
found in the CTP project with this key.
fetchCachedTypeId in interface TypeServicekey - the key by which a Type id should be fetched from the CTP project.CompletionStage<Optional<String>> in which the result of its
completion could contain an Optional with the id inside of it or an empty Optional if no
Channel was found in the CTP project with this key.public void invalidateCache()
TypeServiceinvalidateCache in interface TypeService