Package com.atlan.cache
Class AbstractMassTrackingCache<T extends AtlanObject>
java.lang.Object
com.atlan.cache.AbstractMassCache<T>
com.atlan.cache.AbstractMassTrackingCache<T>
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Direct Known Subclasses:
AtlanTagCache
,CustomMetadataCache
Base class for reusable components that are common to all caches, where
a cache is populated en-masse through batch refreshing and furthermore
where any cache misses are also tracked (to avoid attempting to refresh
the cache unnecessarily).
-
Field Summary
Fields inherited from class com.atlan.cache.AbstractMassCache
bulkRefresh, client, lastRefresh, lock, needsRefresh, refreshLock
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addDeletedId
(String id) Add the provided ID for tracking as deleted.protected void
addDeletedName
(String name) Add the provided name for tracking as deleted.getIdForName
(String name, long minimumTime) Translate the provided human-readable name to its Atlan-internal ID string.getNameForId
(String id, long minimumTime) Translate the provided Atlan-internal ID string to the human-readable name for the object.getNameForSid
(String sid, long minimumTime) Translate the provided Atlan-internal secondary ID string to the human-readable name for the object.getSidForName
(String name, long minimumTime) Translate the provided human-readable name to its Atlan-internal secondary ID string.protected boolean
isDeletedId
(String id) Check whether the provided ID has already been tracked as deleted.protected boolean
isDeletedName
(String name) Check whether the provided name has already been tracked as deleted.protected void
refresh
(long minimumTime) Consider whether to refresh the cache, based on when it was last refreshed.protected void
Logic to refresh a specific cache en-masse (must be implemented).Methods inherited from class com.atlan.cache.AbstractMassCache
cache, cache, cacheById, cacheByName, cacheBySid, close, entrySet, forceRefresh, getBulkRefresh, getById, getById, getByName, getByName, getBySid, getBySid, getIdForName, getIdForName, getIdForSid, getIdForSid, getIdFromName, getIdFromSid, getNameForId, getNameForId, getNameForSid, getNameForSid, getNameFromId, getNameFromId, getNameFromSid, getObjectById, getSidForName, getSidForName, getSidFromId, getSidFromName, isEmpty, isIdKnown, isNameKnown, lookupById, lookupByName, lookupBySid, refreshIfNeeded
-
Constructor Details
-
AbstractMassTrackingCache
-
-
Method Details
-
refreshCache
Logic to refresh a specific cache en-masse (must be implemented).- Specified by:
refreshCache
in classAbstractMassCache<T extends AtlanObject>
- Throws:
AtlanException
- on any error communicating with Atlan to refresh the cache of objects
-
refresh
Consider whether to refresh the cache, based on when it was last refreshed.- Parameters:
minimumTime
- epoch-based time (in milliseconds) to compare against the time the cache was last refreshed- Throws:
AtlanException
- on any API communication problem if the cache needs to be refreshed
-
isDeletedName
Check whether the provided name has already been tracked as deleted.- Parameters:
name
- to check is known to be deleted- Returns:
- true if the name is known to be deleted
-
addDeletedName
Add the provided name for tracking as deleted.- Parameters:
name
- to mark as known-deleted
-
isDeletedId
Check whether the provided ID has already been tracked as deleted.- Parameters:
id
- to check is known to be deleted- Returns:
- true if the ID is known to be deleted
-
addDeletedId
Add the provided ID for tracking as deleted.- Parameters:
id
- to mark as known-deleted
-
getIdForName
Translate the provided human-readable name to its Atlan-internal ID string.- Parameters:
name
- human-readable name of the objectminimumTime
- epoch-based time (in milliseconds) to compare against the time the cache was last refreshed- Returns:
- unique Atlan-internal ID string for the object
- Throws:
AtlanException
- on any API communication problem if the cache needs to be refreshedNotFoundException
- if the object cannot be found (does not exist) in AtlanInvalidRequestException
- if no name was provided for the object to retrieve
-
getNameForId
Translate the provided Atlan-internal ID string to the human-readable name for the object.- Parameters:
id
- Atlan-internal ID stringminimumTime
- epoch-based time (in milliseconds) to compare against the time the cache was last refreshed- Returns:
- unique Atlan-internal ID string for the object
- Throws:
AtlanException
- on any API communication problem if the cache needs to be refreshedNotFoundException
- if the object cannot be found (does not exist) in AtlanInvalidRequestException
- if no name was provided for the object to retrieve
-
getSidForName
Translate the provided human-readable name to its Atlan-internal secondary ID string.- Parameters:
name
- human-readable name of the objectminimumTime
- epoch-based time (in milliseconds) to compare against the time the cache was last refreshed- Returns:
- unique Atlan-internal secondary ID string for the object
- Throws:
AtlanException
- on any API communication problem if the cache needs to be refreshedNotFoundException
- if the object cannot be found (does not exist) in AtlanInvalidRequestException
- if no name was provided for the object to retrieve
-
getNameForSid
Translate the provided Atlan-internal secondary ID string to the human-readable name for the object.- Parameters:
sid
- Atlan-internal secondary ID stringminimumTime
- epoch-based time (in milliseconds) to compare against the time the cache was last refreshed- Returns:
- human-readable name of the object
- Throws:
AtlanException
- on any API communication problem if the cache needs to be refreshedNotFoundException
- if the object cannot be found (does not exist) in AtlanInvalidRequestException
- if no name was provided for the object to retrieve
-