Examples of DotCacheAdministrator


Examples of com.dotmarketing.business.DotCacheAdministrator

      return null;
      }
  }
   
    public static void removeContainerStructures(String containerIdentifier) {
      DotCacheAdministrator cache = CacheLocator.getCacheAdministrator();
        cache.remove(getContainerStructureGroup() + containerIdentifier, getContainerStructureGroup());
    }
View Full Code Here

Examples of com.dotmarketing.business.DotCacheAdministrator

      DotCacheAdministrator cache = CacheLocator.getCacheAdministrator();
        cache.remove(getContainerStructureGroup() + containerIdentifier, getContainerStructureGroup());
    }
   
    public static void clearCache(){
    DotCacheAdministrator cache = CacheLocator.getCacheAdministrator();
      //clear the cache
      cache.flushGroup(getPrimaryGroup());
  }
View Full Code Here

Examples of com.dotmarketing.business.DotCacheAdministrator

   * This method removes the asset key from the cache and send an invalidation message
   * to the cluster when the cms is in cluster
   * @param asset
   */
  public static void removeAssetFromCache(Versionable asset){
    DotCacheAdministrator cache = CacheLocator.getCacheAdministrator();
      HostAPI hostAPI = APILocator.getHostAPI();

    try{
        User systemUser = APILocator.getUserAPI().getSystemUser();
        Host host = hostAPI.findParentHost((Treeable)asset, systemUser, false);
        if(host == null)
          return;
        String hostId = host.getIdentifier();
      Identifier identifier = APILocator.getIdentifierAPI().find(asset);

      if(identifier.getAssetType().equals("contentlet")){
        Contentlet c = (Contentlet) asset;
        long languageId = UtilMethods.isSet(c.getLanguageId())?c.getLanguageId():APILocator.getLanguageAPI().getDefaultLanguage().getId();
        cache.remove(getPrimaryGroup() + hostId + ":" + identifier.getURI(),getPrimaryGroup() + "_" + hostId + "_" + languageId  );
      } else {
        cache.remove(getPrimaryGroup() + hostId + ":" + identifier.getURI(),getPrimaryGroup() + "_" + hostId);
      }

    }catch (Exception e) {
      Logger.error(LiveCache.class, "Unable to remove asset from live cache", e);
    }
View Full Code Here

Examples of com.dotmarketing.business.DotCacheAdministrator

      Logger.error(LiveCache.class, "Unable to remove asset from live cache", e);
    }
  }

  public static void clearCache(String hostId){
    DotCacheAdministrator cache = CacheLocator.getCacheAdministrator();
      //clear the cache
      cache.flushGroup(getPrimaryGroup() + "_" + hostId);
  }
View Full Code Here

Examples of com.dotmarketing.business.DotCacheAdministrator

      return getPathFromCache (URI, host.getIdentifier());
  }

      //Working cache methods
  public static String getPathFromCache(String URI, String hostId) throws DotStateException, DotDataException, DotSecurityException{
    DotCacheAdministrator cache = CacheLocator.getCacheAdministrator();
    String _uri = null;
    try{
      _uri = (String) cache.get(getPrimaryGroup() + hostId + "-" + URI,getPrimaryGroup() + "_" + hostId);
    }catch (DotCacheException e) {
      Logger.debug(WorkingCache.class, "Cache Entry not found", e);
      }

    if(_uri != null) return _uri;
View Full Code Here

Examples of com.dotmarketing.business.DotCacheAdministrator

  public static void removeURIFromCache(String URI, Host host){
      removeURIFromCache (URI, host.getIdentifier());
  }
 
  public static void removeURIFromCache(String URI, String hostId){
    DotCacheAdministrator cache = CacheLocator.getCacheAdministrator();
      cache.remove(getPrimaryGroup() + hostId + "-" + URI,getPrimaryGroup() + "_" + hostId)
  }
View Full Code Here

Examples of com.dotmarketing.business.DotCacheAdministrator

    DotCacheAdministrator cache = CacheLocator.getCacheAdministrator();
      cache.remove(getPrimaryGroup() + hostId + "-" + URI,getPrimaryGroup() + "_" + hostId)
  }

  public static void removeAssetFromCache(Versionable asset) throws DotStateException, DotDataException{
    DotCacheAdministrator cache = CacheLocator.getCacheAdministrator();
    Identifier identifier = APILocator.getIdentifierAPI().find(asset);
    cache.remove(getPrimaryGroup() + identifier.getHostId() + "-" + identifier.getURI(),getPrimaryGroup() + "_" + identifier.getHostId());
  }
View Full Code Here

Examples of com.dotmarketing.business.DotCacheAdministrator

    Identifier identifier = APILocator.getIdentifierAPI().find(asset);
    cache.remove(getPrimaryGroup() + identifier.getHostId() + "-" + identifier.getURI(),getPrimaryGroup() + "_" + identifier.getHostId());
  }
 
  public static void clearCache(String hostId){
    DotCacheAdministrator cache = CacheLocator.getCacheAdministrator();
      //clear the cache
      cache.flushGroup(getPrimaryGroup() + "_" + hostId);
  }
View Full Code Here

Examples of com.dotmarketing.business.DotCacheAdministrator

     * Find the given url in the cache
     * @param url
     * @return The redirection path used by the cms to properly redirect the virtual link
     */
    public static String getPathFromCache(String url) {
      DotCacheAdministrator cache = CacheLocator.getCacheAdministrator();
      String realLink = null;
      try{
        realLink = (String) cache.get(sanitizeKey(url),getPrimaryGroup());
      }catch (DotCacheException e) {
      Logger.debug(VirtualLinksCache.class, "Cache Entry not found", e);
      }
       
        if(realLink != null) {
          if(realLink.equals(WebKeys.Cache.CACHE_NOT_FOUND)){
            return null;
          }
          else{
            return realLink;
          }
        }
       
        VirtualLink vl = null;
        try{
          vl = VirtualLinkFactory.getVirtualLinkByURL(url);
        }
        catch(DotHibernateException dhe){
          Logger.debug(VirtualLinksCache.class, "failed to find: " + url)
        }
       

    if(vl != null && InodeUtils.isSet(vl.getInode()))
    {
      addPathToCache(vl);
    } else {

            cache.put(sanitizeKey(url), WebKeys.Cache.CACHE_NOT_FOUND, getPrimaryGroup());
            return null;
    }

        return vl.getUri();

View Full Code Here

Examples of com.dotmarketing.business.DotCacheAdministrator

     * a cache invalidation message to force the other peers in the
     * cluster to re-map the key as well
     * @param vl
     */
    public static void addPathToCache(VirtualLink vl){
      DotCacheAdministrator cache = CacheLocator.getCacheAdministrator();
        if (vl != null && InodeUtils.isSet(vl.getInode()))
        {
          Logger.info(VirtualLinksCache.class, "mapping: " + vl.getUrl() + " -> " + vl.getUri());      
            cache.put(sanitizeKey(vl.getUrl())  , vl.getUri(), getPrimaryGroup());
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.