congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
CacheElement.setNull
Code IndexAdd Tabnine to your IDE (free)

How to use
setNull
method
in
org.dd4t.caching.CacheElement

Best Java code snippets using org.dd4t.caching.CacheElement.setNull (Showing top 5 results out of 315)

origin: org.dd4t/dd4t-caching

/**
 * Store given item in the cache with a simple time-to-live property.
 *
 * @param key          String representing the key to store the payload under
 * @param cacheElement CacheElement a wrapper around the actual value to store in
 *                     cache
 */
@Override
public <T> void storeInItemCache(String key, CacheElement<T> cacheElement) {
  if (!isEnabled()) {
    return;
  }
  if (!cacheExists()) {
    LOG.error("Cache configuration is invalid! NOT Caching. Check EH Cache configuration.");
    return;
  }
  // detect undeclared nulls, complain, and set to null
  if (!cacheElement.isNull() && cacheElement.getPayload() == null) {
    Exception exToLogToHaveStacktraceWhoCausedIt = new Exception();
    LOG.error("Detected undeclared null payload on element with key " + key + " at insert time!",
        exToLogToHaveStacktraceWhoCausedIt);
    cacheElement.setNull(true);
  }
  cacheElement.setExpired(false);
  storeElement(key, cacheElement);
}
origin: org.dd4t/dd4t-caching

@Override
public <T> void storeInItemCache(String key, CacheElement<T> cacheElement, List<CacheDependency> dependencies) {
  if (!isEnabled()) {
    return;
  }
  if (!cacheExists()) {
    LOG.error("Cache configuration is invalid! NOT Caching. Check EH Cache configuration.");
    return;
  }
  // detect undeclared nulls, complain, and set to null
  if (!cacheElement.isNull() && cacheElement.getPayload() == null) {
    Exception exToLogToHaveStacktraceWhoCausedIt = new Exception();
    LOG.error("Detected undeclared null payload on element with key " + key + " at insert time!",
        exToLogToHaveStacktraceWhoCausedIt);
    cacheElement.setNull(true);
  }
  cacheElement.setExpired(false);
  Element element = cache.get(key);
  if (element == null) {
    element = new Element(key, cacheElement);
  }
  cache.put(element);
  element.setTimeToLive(cacheDependencyTTL);
  for (CacheDependency dep : dependencies) {
    String dependentKey = getKey(dep.getPublicationId(), dep.getItemId());
    cacheElement.setDependentKey(dependentKey);
    addDependency(key, dependentKey);
    updateTTL(dependencyCache.get(dependentKey));
  }
}
origin: org.dd4t/dd4t-core

cacheElement.setNull(true);
cacheProvider.storeInItemCache(uri, cacheElement);
throw new ItemNotFoundException("Unable to find page by id " + uri);
origin: org.dd4t/dd4t-caching

@Override
public <T> void storeInItemCache(final String key, final CacheElement<T> cacheElement, final
List<CacheDependency> dependencies) {
  if (!isEnabled()) {
    return;
  }
  if (!cacheExists()) {
    LOG.error("Cache configuration is invalid! NOT Caching. Check EH Cache configuration.");
    return;
  }
  // detect undeclared nulls, complain, and set to null
  if (!cacheElement.isNull() && cacheElement.getPayload() == null) {
    Exception exToLogToHaveStacktraceWhoCausedIt = new Exception();
    LOG.error("Detected undeclared null payload on element with key " + key + " at insert time!",
        exToLogToHaveStacktraceWhoCausedIt);
    cacheElement.setNull(true);
    cacheElement.setExpired(true);
  }
  cacheElement.setExpired(false);
  if (cache.containsKey(key)) {
    cache.replace(key, cacheElement);
  } else {
    cache.put(key, cacheElement);
  }
  for (CacheDependency dep : dependencies) {
    String dependentKey = getKey(dep.getPublicationId(), dep.getItemId());
    cacheElement.setDependentKey(dependentKey);
    addDependency(key, dependentKey);
  }
}
origin: org.dd4t/dd4t-core

cacheElement.setNull(true);
cacheProvider.storeInItemCache(key, cacheElement, publicationId, componentId);
throw new ItemNotFoundException(String.format("Could not find DCP with componentURI: %s and " +
org.dd4t.cachingCacheElementsetNull

Popular methods of CacheElement

  • getPayload
  • isExpired
  • setExpired
  • setPayload
  • getDependentKey
  • isNull
  • setDependentKey

Popular in Java

  • Finding current android device location
  • onCreateOptionsMenu (Activity)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • scheduleAtFixedRate (Timer)
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now