LOG.debug("Discovering Publication id for Binary url: {}", fullUrl); final String key = getKey(CacheType.DISCOVER_IMAGES_URL, fullUrl); final CacheElement<Integer> cacheElement = cacheProvider.loadPayloadFromLocalCache(key); Integer result = Constants.UNKNOWN_PUBLICATION_ID; cacheProvider.storeInItemCache(key, cacheElement); cacheElement.setExpired(false); LOG.debug("Stored Publication Id with key: {} in cache", key);
private String addToCache(String componentURI, String key, CacheElement<String> cacheElement, String result) throws ParseException { String toReturn = result == null ? "" : result; cacheElement.setPayload(toReturn); TCMURI tcmUri = new TCMURI(componentURI); cacheProvider.storeInItemCache(key, cacheElement, tcmUri.getPublicationId(), tcmUri.getItemId()); LOG.debug("Added link url: {} for uri: {} to cache", result, componentURI); return toReturn; }
@Override public String resolve(String componentURI, String pageURI) throws ItemNotFoundException, SerializationException { String key; if (!StringUtils.isEmpty(pageURI)) { key = getCacheKey(componentURI, pageURI); } else { key = getCacheKey(componentURI); } final CacheElement<String> cacheElement = cacheProvider.loadPayloadFromLocalCache(key); String result; if (!validInCache(cacheElement)) { if (!StringUtils.isEmpty(pageURI)) { result = linkProvider.resolveComponentFromPage(componentURI, pageURI); } else { result = linkProvider.resolveComponent(componentURI); } try { result = addToCache(componentURI, key, cacheElement, result); } catch (ParseException e) { String message = String.format("Invalid ComponentURI %s", componentURI); LOG.error(message); throw new SerializationException(message, e); } } else { result = cacheElement.getPayload(); LOG.debug("Return link url: {} for uri: {} from cache", result, componentURI); } return result; }
protected PublicationMeta getPublicationMeta(final int publicationId) { final CacheElement<PublicationMeta> cacheElement = cacheProvider.loadPayloadFromLocalCache(key); if (publicationMeta != null) { cacheElement.setPayload(publicationMeta); cacheProvider.storeInItemCache(key, cacheElement); cacheElement.setExpired(false); LOG.debug("Stored Publication Meta with key: {} in cache", key);
protected PublicationMeta getPublicationMeta(final int publicationId) { final CacheElement<PublicationMeta> cacheElement = cacheProvider.loadPayloadFromLocalCache(key); if (publicationMeta != null) { cacheElement.setPayload(publicationMeta); cacheProvider.storeInItemCache(key, cacheElement); cacheElement.setExpired(false); LOG.debug("Stored Publication Meta with key: {} in cache", key);
LOG.debug("Discovering Publication id for Binary url: {}", fullUrl); final String key = getKey(CacheType.DISCOVER_IMAGES_URL, fullUrl); final CacheElement<Integer> cacheElement = cacheProvider.loadPayloadFromLocalCache(key); Integer result = Constants.UNKNOWN_PUBLICATION_ID; cacheProvider.storeInItemCache(key, cacheElement); cacheElement.setExpired(false); LOG.debug("Stored Publication Id with key: {} in cache", key);
LOG.debug("Discovering Publication id for url: {}", url); final String key = getKey(CacheType.DISCOVER_PUBLICATION_URL, url); final CacheElement<Integer> cacheElement = cacheProvider.loadPayloadFromLocalCache(key); Integer result = Constants.UNKNOWN_PUBLICATION_ID; LOG.debug("Publication Id for URL: {}, is {}", url, result); cacheElement.setPayload(result); cacheProvider.storeInItemCache(key, cacheElement); cacheElement.setExpired(false); LOG.debug("Stored Publication Id with key: {} in cache", key);
LOG.debug("Discovering Publication id for url: {}", url); final String key = getKey(CacheType.DISCOVER_PUBLICATION_URL, url); final CacheElement<Integer> cacheElement = cacheProvider.loadPayloadFromLocalCache(key); Integer result = Constants.UNKNOWN_PUBLICATION_ID; result = pageMeta.getPublicationId(); cacheElement.setPayload(result); cacheProvider.storeInItemCache(key, cacheElement); cacheElement.setExpired(false); LOG.debug("Publication Id for URL: {}, is {}", url, result);
CacheElement<String> cacheElement = cacheProvider.loadPayloadFromLocalCache(cacheKey); cacheProvider.storeInItemCache(cacheKey, cacheElement); cacheElement.setExpired(true); throw new ItemNotFoundException("XML Page with url: " + url + " not found."); cacheProvider.storeInItemCache(cacheKey, cacheElement); cacheElement.setExpired(false);
CacheElement<String> cacheElement = cacheProvider.loadPayloadFromLocalCache(cacheKey); String pageSource; cacheProvider.storeInItemCache(cacheKey, cacheElement); cacheElement.setExpired(true); throw new ItemNotFoundException("Unable to find page by id " + tcmId); cacheProvider.storeInItemCache(cacheKey, cacheElement); cacheElement.setExpired(false); } else {
LOG.debug("Enter getTaxonomy with uri: {}", taxonomyURI); CacheElement<Keyword> cacheElement = cacheProvider.loadPayloadFromLocalCache(taxonomyURI); Keyword taxonomy; if (taxonomySource == null || taxonomySource.length() == 0) { cacheElement.setPayload(null); cacheProvider.storeInItemCache(taxonomyURI, cacheElement); cacheElement.setExpired(true); throw new ItemNotFoundException(String.format("Taxonomy with uri: %s not found.", cacheProvider.storeInItemCache(taxonomyURI, cacheElement, tcmUri.getPublicationId(), tcmUri .getItemId()); cacheElement.setExpired(false);
CacheElement<Keyword> cacheElement = cacheProvider.loadPayloadFromLocalCache(key); Keyword taxonomy; if (taxonomySource == null || taxonomySource.length() == 0) { cacheElement.setPayload(null); cacheProvider.storeInItemCache(taxonomyURI, cacheElement); cacheElement.setExpired(true); throw new ItemNotFoundException("Taxonomy with uri: " + taxonomyURI + " not found."); cacheProvider.storeInItemCache(key, cacheElement, tcmUri.getPublicationId(), tcmUri.getItemId ()); cacheElement.setExpired(false); } catch (ItemNotFoundException e) { cacheElement.setPayload(null); cacheProvider.storeInItemCache(taxonomyURI, cacheElement); cacheElement.setExpired(true); LOG.error(e.getLocalizedMessage(), e);
CacheElement<Integer> cacheElement = cacheProvider.loadPayloadFromLocalCache(key); Integer result = 0; cacheProvider.storeInItemCache(key, cacheElement, tcmuri.getPublicationId(), tcmuri.getItemId ()); cacheElement.setExpired(false); result = 0; cacheElement.setPayload(result); cacheProvider.storeInItemCache(key, cacheElement); cacheElement.setExpired(false);
CacheElement<Page> cacheElement = cacheProvider.loadPayloadFromLocalCache(cacheKey); Page page; cacheProvider.storeInItemCache(cacheKey, cacheElement); cacheElement.setExpired(true); throw new ItemNotFoundException("Page with url: " + url + " not found."); cacheProvider.storeInItemCache(cacheKey, cacheElement, resultItem.getPublicationId(), resultItem .getItemId()); cacheElement.setExpired(false);
LOG.debug("Enter getBinaryByURI with uri: {}", tcmUri); CacheElement<Binary> cacheElement = cacheProvider.loadPayloadFromLocalCache(tcmUri); Binary binary; cacheElement.setPayload(binary); TCMURI binaryURI = new TCMURI(tcmUri); cacheProvider.storeInItemCache(tcmUri, cacheElement, binaryURI.getPublicationId(), binaryURI .getItemId()); cacheElement.setExpired(false); } catch (ParseException e) { cacheElement.setPayload(null); cacheProvider.storeInItemCache(tcmUri, cacheElement); cacheElement.setExpired(true); throw new ItemNotFoundException(e);
CacheElement<Page> cacheElement = cacheProvider.loadPayloadFromLocalCache(uri); Page page; cacheElement.setPayload(null); cacheElement.setNull(true); cacheProvider.storeInItemCache(uri, cacheElement); throw new ItemNotFoundException("Unable to find page by id " + uri); cacheProvider.storeInItemCache(uri, cacheElement, tcmUri.getPublicationId(), tcmUri.getItemId()); cacheElement.setExpired(false); LOG.debug("Added page with uri: {} to cache", uri);
CacheElement<Binary> cacheElement = cacheProvider.loadPayloadFromLocalCache(key); Binary binary; cacheProvider.storeInItemCache(key, cacheElement, tcmUri.getPublicationId(), tcmUri.getItemId ()); cacheElement.setExpired(false);
CacheElement<Integer> cacheElement = cacheProvider.loadPayloadFromLocalCache(key); Integer result = null; TCMURI tcmuri = new TCMURI(results[0]); cacheElement.setPayload(result); cacheProvider.storeInItemCache(key, cacheElement, tcmuri.getPublicationId(), tcmuri .getItemId()); cacheElement.setExpired(false); result = 0; cacheElement.setPayload(result); cacheProvider.storeInItemCache(key, cacheElement); cacheElement.setExpired(false);
CacheElement<ComponentPresentation> cacheElement = cacheProvider.loadPayloadFromLocalCache(key); cacheElement.setPayload(null); cacheElement.setNull(true); cacheProvider.storeInItemCache(key, cacheElement, publicationId, componentId); throw new ItemNotFoundException(String.format("Could not find DCP with componentURI: %s and " + "templateURI: %s", parsedComponentUri, templateURI)); this.executeProcessors(componentPresentation.getComponent(), RunPhase.BEFORE_CACHING, context); cacheElement.setPayload(componentPresentation); cacheProvider.storeInItemCache(key, cacheElement, publicationId, componentId); cacheElement.setExpired(false); LOG.debug("Added component with uri: {} and template: {} to cache", parsedComponentUri, templateURI);