Package alluxio.client.file
Class CacheContext
- java.lang.Object
-
- alluxio.client.file.CacheContext
-
public class CacheContext extends java.lang.Object
Cache related context.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CacheContext.StatsUnit
Stats Unit.
-
Constructor Summary
Constructors Modifier Constructor Description protected
CacheContext()
Expected to be inherited in PrestoDB or other local cache caller.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CacheContext
defaults()
boolean
equals(java.lang.Object o)
java.lang.String
getCacheIdentifier()
Returns an string as a hint from computation to indicate the file.CacheQuota
getCacheQuota()
CacheScope
getCacheScope()
HiveCacheContext
getHiveCacheContext()
int
hashCode()
void
incrementCounter(java.lang.String name, long value)
Increments the countername
byvalue
.void
incrementCounter(java.lang.String name, CacheContext.StatsUnit unit, long value)
Increments the countername
byvalue
.boolean
isTemporary()
CacheContext
setCacheIdentifier(java.lang.String identifier)
CacheContext
setCacheQuota(CacheQuota cacheQuota)
CacheContext
setCacheScope(CacheScope cacheScope)
CacheContext
setHiveCacheContext(HiveCacheContext hiveCacheContext)
CacheContext
setTemporary(boolean isTemporary)
java.lang.String
toString()
-
-
-
Method Detail
-
defaults
public static CacheContext defaults()
- Returns:
- the default CacheContext
-
getCacheIdentifier
@Nullable public java.lang.String getCacheIdentifier()
Returns an string as a hint from computation to indicate the file. Note that, this can be independent and different from Alluxio File ID stored in URIStatus.mInfo, which is assigned and maintained by Alluxio master. In cases like using Alluxio local cache, such Alluxio File ID may not be available.- Returns:
- the unique string identifier of the entity to cache
-
getHiveCacheContext
@Nullable public HiveCacheContext getHiveCacheContext()
- Returns:
- the hive cache context
-
getCacheQuota
public CacheQuota getCacheQuota()
- Returns:
- the cache quota
-
getCacheScope
public CacheScope getCacheScope()
- Returns:
- the cache scope
-
setCacheIdentifier
public CacheContext setCacheIdentifier(java.lang.String identifier)
- Parameters:
identifier
- the id to use- Returns:
- the updated
CacheContext
-
setCacheQuota
public CacheContext setCacheQuota(CacheQuota cacheQuota)
- Parameters:
cacheQuota
- the cache quota- Returns:
- the updated
CacheContext
-
setCacheScope
public CacheContext setCacheScope(CacheScope cacheScope)
- Parameters:
cacheScope
- the cache quota- Returns:
- the updated
CacheContext
-
setHiveCacheContext
public CacheContext setHiveCacheContext(HiveCacheContext hiveCacheContext)
- Parameters:
hiveCacheContext
- the hive cache context- Returns:
- the updated
CacheContext
-
isTemporary
public boolean isTemporary()
- Returns:
- whether the caching data is temporary
-
setTemporary
public CacheContext setTemporary(boolean isTemporary)
- Parameters:
isTemporary
- whether the caching data is temporary- Returns:
- the updated
CacheContext
-
incrementCounter
public void incrementCounter(java.lang.String name, long value)
Increments the countername
byvalue
.Default implementation does nothing. Subclass can implement its own tracking mechanism.
- Parameters:
name
- name of the countervalue
- value of the counter
-
incrementCounter
public void incrementCounter(java.lang.String name, CacheContext.StatsUnit unit, long value)
Increments the countername
byvalue
.Default implementation does nothing. Subclass can implement its own tracking mechanism.
- Parameters:
name
- name of the counterunit
- unit of the countervalue
- value of the counter
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-