Package railo.runtime.cache

Examples of railo.runtime.cache.CacheConnection


        Element[] children = ConfigWebFactory.getChildren(parent,"connection");
        for(int i=0;i<children.length;i++) {
            String n=children[i].getAttribute("name");
          if(n!=null && n.equalsIgnoreCase(name)) {
            Map<String, CacheConnection> conns = config.getCacheConnections();
            CacheConnection cc= conns.get(n.toLowerCase());
            if(cc!=null)Util.removeEL(config instanceof ConfigWeb?(ConfigWeb)config:null,cc);
            parent.removeChild(children[i]);
        }
        }
       
View Full Code Here


        if(ds.isStorage())return storage;
        throw new ApplicationException("datasource ["+storage+"] is not enabled to be used as session/client storage");
      }
   
      // cache
      CacheConnection cc = Util.getCacheConnection(config, storage,null);
      if(cc!=null) {
        if(cc.isStorage())return storage;
        throw new ApplicationException("cache ["+storage+"] is not enabled to be used as session/client storage");
      }
     
      String sdx=StringUtil.soundex(storage);
     
View Full Code Here

  }
 

  private static Cache getCache(Config config, String cacheName) throws PageException {
    try {
      CacheConnection cc = Util.getCacheConnection(config,cacheName);
      if(!cc.isStorage())
        throw new ApplicationException("storage usage for this cache is disabled, you can enable this in the railo administrator.");
      return cc.getInstance(config);
    } catch (IOException e) {
      throw Caster.toPageException(e);
    }
  }
View Full Code Here

  }

  protected void _clean() {
    ConfigWebImpl config = (ConfigWebImpl) engine.getFactory().getConfig();
    Map<String, CacheConnection> connections = config.getCacheConnections();
    CacheConnection cc;
   
    if(connections!=null) {
      Map.Entry<String, CacheConnection> entry;
      Iterator<Entry<String, CacheConnection>> it = connections.entrySet().iterator();
      while(it.hasNext()){
        entry=it.next();
        cc=entry.getValue();
        if(cc.isStorage()){
          try {
            clean(cc,config);
          } catch (IOException e) {
            error(e);
          }
View Full Code Here

    int type = Util.toType(strType,ConfigImpl.CACHE_DEFAULT_NONE);
    if(type==ConfigImpl.CACHE_DEFAULT_NONE)
      throw new FunctionException(pc,"CacheGetDefaultCacheName",1,"type","invalid type defintion ["+strType+"], valid types are [object,resource,template,query]");
   
    ConfigImpl config=(ConfigImpl) pc.getConfig();
    CacheConnection conn = config.getCacheDefaultConnection(type);
    if(conn==null)
      throw new ExpressionException("there is no default cache defined for type ["+strType+"]");
   
    return conn.getName();
  }
View Full Code Here

      if(name.equalsIgnoreCase("template"))
        list.add(config.getCacheDefaultConnection(ConfigImpl.CACHE_DEFAULT_TEMPLATE));
      else if(name.equalsIgnoreCase("object"))
        list.add(config.getCacheDefaultConnection(ConfigImpl.CACHE_DEFAULT_OBJECT));
      else{
        CacheConnection cc= config.getCacheConnections().get(name);
        if(cc==null) throw new CacheException("there is no cache defined with name ["+name+"]");
        list.add(cc);
      }
    }
    return list.toArray(new CacheConnection[list.size()]);
View Full Code Here

      Cache cc = getCache(config, name, null);
      if(cc!=null) return cc;
    }
   
    // get default from config
    CacheConnection cc= ((ConfigImpl)config).getCacheDefaultConnection(type);
    if(cc==null) return defaultValue;
    try {
      return cc.getInstance(config);
    } catch (Throwable t) {
      return defaultValue;
    }
  }
View Full Code Here

      if(cc!=null) return cc;
    }
   
    // get default from config
    Config config = ThreadLocalPageContext.getConfig(pc);
    CacheConnection cc= ((ConfigImpl)config).getCacheDefaultConnection(type);
    if(cc==null) throw new CacheException("there is no default "+toStringType(type,"")+" cache defined, you need to define this default cache in the Railo Administrator");
    return cc.getInstance(config);
   
   
  }
View Full Code Here

    return getCache(ThreadLocalPageContext.getConfig(pc), cacheName,defaultValue);
  }
 
 
  public static Cache getCache(Config config,String cacheName) throws IOException {
    CacheConnection cc=  config.getCacheConnections().get(cacheName.toLowerCase().trim());
    if(cc==null) throw noCache(config,cacheName);
    return cc.getInstance(config)
  }
View Full Code Here

    if(cc==null) throw noCache(config,cacheName);
    return cc.getInstance(config)
  }
 
  public static Cache getCache(Config config,String cacheName, Cache defaultValue) {
    CacheConnection cc= config.getCacheConnections().get(cacheName.toLowerCase().trim());
    if(cc==null) return defaultValue;
    try {
      return cc.getInstance(config);
    } catch (Throwable t) {
      return defaultValue;
   
  }
View Full Code Here

TOP

Related Classes of railo.runtime.cache.CacheConnection

Copyright © 2018 www.massapicom. 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.