use of org.wso2.carbon.identity.application.authentication.framework.cache.LongWaitResultCacheKey in project carbon-identity-framework by wso2.
the class CacheBackedLongWaitStatusDAO method getWaitStatus.
public LongWaitStatus getWaitStatus(String waitKey) throws FrameworkException {
LongWaitStatus status = null;
LongWaitResultCacheEntry valueFromCache = LongWaitResultCache.getInstance().getValueFromCache(new LongWaitResultCacheKey(waitKey));
if (valueFromCache != null) {
status = valueFromCache.getWaitStatus();
}
if (status == null) {
status = waitStatusDAO.getWaitStatus(waitKey);
LongWaitResultCacheKey cacheKey = new LongWaitResultCacheKey(waitKey);
LongWaitResultCacheEntry cacheEntry = new LongWaitResultCacheEntry(status);
LongWaitResultCache.getInstance().addToCache(cacheKey, cacheEntry);
}
return status;
}
use of org.wso2.carbon.identity.application.authentication.framework.cache.LongWaitResultCacheKey in project carbon-identity-framework by wso2.
the class CacheBackedLongWaitStatusDAO method addWaitStatus.
public void addWaitStatus(int tenantId, String waitKey, LongWaitStatus status, Timestamp createdTime, Timestamp expireTime) throws FrameworkException {
if (waitKey != null) {
// Add to database.
waitStatusDAO.addWaitStatus(tenantId, waitKey, status, createdTime, expireTime);
// Add to cache.
LongWaitResultCacheKey cacheKey = new LongWaitResultCacheKey(waitKey);
LongWaitResultCacheEntry cacheEntry = new LongWaitResultCacheEntry(status);
LongWaitResultCache.getInstance().addToCache(cacheKey, cacheEntry);
}
}
use of org.wso2.carbon.identity.application.authentication.framework.cache.LongWaitResultCacheKey in project carbon-identity-framework by wso2.
the class CacheBackedLongWaitStatusDAO method removeWaitStatus.
public void removeWaitStatus(String waitKey) throws FrameworkException {
waitStatusDAO.removeWaitStatus(waitKey);
// Add status as completed.
LongWaitResultCacheKey cacheKey = new LongWaitResultCacheKey(waitKey);
LongWaitStatus status = new LongWaitStatus();
status.setStatus(LongWaitStatus.Status.UNKNOWN);
LongWaitResultCacheEntry cacheEntry = new LongWaitResultCacheEntry(status);
LongWaitResultCache.getInstance().addToCache(cacheKey, cacheEntry);
}
Aggregations