Package com.adobe.granite.contexthub.api
Interface ContextHubCache
-
public interface ContextHubCache
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
ContextHubCache.CodeType
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
cacheCode(SlingHttpServletRequest request, ContextHubCache.CodeType codeType, java.lang.String code)
Stores the supplied code in the cache.java.lang.String
getCode(SlingHttpServletRequest request, ContextHubCache.CodeType codeType)
Retrieves the code for the particular contexthub configuration and corresponding to the given codeType from the cache.java.util.Map
getCodeMetadata(SlingHttpServletRequest request, ContextHubCache.CodeType codeType)
Retrieves the metadata for the code stored in the cache - for the particular contexthub configuration and corresponding to the given codeType.void
setCodeMetadata(SlingHttpServletRequest request, ContextHubCache.CodeType codeType, java.util.Map metadata)
Stores the supplied metadata in the cache.
-
-
-
Method Detail
-
getCode
java.lang.String getCode(SlingHttpServletRequest request, ContextHubCache.CodeType codeType)
Retrieves the code for the particular contexthub configuration and corresponding to the given codeType from the cache. The contexthub configuration, for which the code needs to be returned, is retrieved from the given request object.- Parameters:
request
- The request object from which the contexthub configuration path is retrievedcodeType
- the type of code to return- Returns:
String
containing the code if the code is present in the cache
null
if code is not found in the cache
-
getCodeMetadata
java.util.Map getCodeMetadata(SlingHttpServletRequest request, ContextHubCache.CodeType codeType)
Retrieves the metadata for the code stored in the cache - for the particular contexthub configuration and corresponding to the given codeType. The contexthub configuration, for which the metadata needs to be returned, is retrieved from the given request object.- Parameters:
request
- The request object from which the contexthub configuration path is retrievedcodeType
- the type of code corresponding to which the metadata should be returned- Returns:
Map
containing the metadata as key-value pairs if the code and its corresponding metadata is present in the cache
The returned map would be empty if the code or its corresponding metadata is not found in the cache
-
cacheCode
void cacheCode(SlingHttpServletRequest request, ContextHubCache.CodeType codeType, java.lang.String code)
Stores the supplied code in the cache. The code is mapped and stored for the particular contexthub configuration and corresponding to the given codeType. The contexthub configuration, corresponding to which the code needs to be stored, is retrieved from the given request object.- Parameters:
request
- The request object from which the contexthub configuration path is retrievedcodeType
- The type of code corresponding to which the code needs to be stored.code
- the code to store
-
setCodeMetadata
void setCodeMetadata(SlingHttpServletRequest request, ContextHubCache.CodeType codeType, java.util.Map metadata)
Stores the supplied metadata in the cache. The metadata is mapped and stored for the particular contexthub configuration and corresponding to the given codeType. The contexthub configuration, corresponding to which the metadata needs to be stored, is retrieved from the given request object.- Parameters:
request
- The request object from which the contexthub configuration path is retrievedcodeType
- The type of code corresponding to which the metadata needs to storedmetadata
- The metadata to store
-
-