Examples of CacheFactory


Examples of com.gemstone.gemfire.cache.CacheFactory

    @Before
    @Override
    public void setUp() {
        super.setUp();
        cache = new CacheFactory()
                .set("name", "Test")
                .set("log-level", "warning")
                .set("cache-xml-file", "gemfire.xml")
                .create();
    }
View Full Code Here

Examples of com.volantis.cache.CacheFactory

        partitions = new ArrayList();

        // Iterate over all the partitions in the builder creating a group for
        // them.
        CacheFactory factory = CacheFactory.getDefaultInstance();
        for (Iterator i = partitionList.iterator(); i.hasNext();) {
            RemotePartitionsBuilder.Partition builderQuota =
                    (RemotePartitionsBuilder.Partition) i.next();
            GroupBuilder groupBuilder = factory.createGroupBuilder();
            groupBuilder.setMaxCount(builderQuota.getSize());
            String prefix = builderQuota.getPrefix();
            Group group = defaultRemoteGroup.addGroup(prefix,
                    groupBuilder);
View Full Code Here

Examples of javax.cache.CacheFactory

    try {
      @SuppressWarnings("rawtypes")
      Map props = new HashMap();
      props.put(GCacheFactory.EXPIRATION_DELTA, 3600*24); // cache expires in one day
      CacheFactory cacheFactory = CacheManager.getInstance().getCacheFactory();
      cache = cacheFactory.createCache(props);
    } catch (CacheException e) {
      log.severe("Error initialising station storage. Cache is not used!: " + e.toString());
    }
  }
View Full Code Here

Examples of javax.cache.CacheFactory

    try {
      @SuppressWarnings("rawtypes")
      Map props = new HashMap();
      props.put(GCacheFactory.EXPIRATION_DELTA, 3600*24); // cache expires in one day
      CacheFactory cacheFactory = CacheManager.getInstance().getCacheFactory();
      cache = cacheFactory.createCache(props);
    } catch (CacheException e) {
      log.severe("Error initialising station storage. Cache is not used!: " + e.toString());
    }
  }
View Full Code Here

Examples of net.sf.cache4j.CacheFactory

     * {@link net.sf.cache4j.CacheFactory}.
     * @param in �������� ����� � XML �������������
     * @throws CacheException ���� ������� ������ � ������������
     */
    public static void loadConfig(InputStream in) throws CacheException {
        CacheFactory cf = CacheFactory.getInstance();

        try {
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            DocumentBuilder builder = factory.newDocumentBuilder();
            Document document = builder.parse(in);

            NodeList nodeList = document.getChildNodes();
            Node node = nodeList==null || nodeList.getLength()==0 ? null : nodeList.item(0);

            //�������� ���� ������ ���������� cache-config
            if (node==null || !"cache-factory".equalsIgnoreCase(node.getNodeName())) {
                throw new CacheException("root node must be \"cache-factory\"");
            }

            if ((node instanceof Element)) {
                long cleanInteval = getTimeLong(((Element)node).getAttribute("clean-interval"));
                if(cleanInteval>0){
                    cf.setCleanInterval(cleanInteval);
                } else {
                    //�� ��������� 30 ������
                    cf.setCleanInterval(30000); //30sec
                }
            }

            for (Node n = node.getFirstChild(); n != null; n = n.getNextSibling()) {
                if ((n instanceof Element) && "cache".equalsIgnoreCase(n.getNodeName())) {
                    Cache cache = null;
                    CacheConfig config = null;

                    String id = ((Element)n).getAttribute("id");
                    String desc = ((Element)n).getAttribute("desc");
                    long ttl = getTimeLong(((Element)n).getAttribute("ttl"));
                    long idle = getTimeLong(((Element)n).getAttribute("idle"));
                    long maxMemorySize = getCapacityLong(((Element)n).getAttribute("max-memory-size"));
                    int maxSize = getInt(((Element)n).getAttribute("max-size"));

                    String type = ((Element)n).getAttribute("type");
                    if(type==null || type.trim().length()==0){
                        type = "synchronized";
                    }
                    type = type.trim().toLowerCase();
                    if(type.equals("blocking")){
                        cache = new BlockingCache();
                    } else if(type.equals("synchronized")) {
                        cache = new SynchronizedCache();
                    } else if(type.equals("nocache")) {
                        cache = new EmptyCache();
                    } else {
                        throw new CacheException("Unknown cache type:"+type);
                    }

                    String algorithm = ((Element)n).getAttribute("algorithm");
                    if(algorithm==null || algorithm.trim().length()==0){
                        algorithm = "lru";
                    }
                    algorithm = algorithm.trim().toLowerCase();
                    if(!algorithm.equals(CacheConfigImpl.LRU) &&
                       !algorithm.equals(CacheConfigImpl.LFU) &&
                       !algorithm.equals(CacheConfigImpl.FIFO) ) {
                        throw new CacheException("Unknown cache algorithm:"+algorithm);
                    }

                    String reference = ((Element)n).getAttribute("reference");
                    if(reference==null || reference.trim().length()==0){
                        reference = "strong";
                    }
                    reference = reference.trim().toLowerCase();
                    if(!reference.equals("strong") && !reference.equals("soft") ) {
                        throw new CacheException("Unknown cache object reference:"+reference);
                    }

                    config = new CacheConfigImpl(id, desc, ttl, idle, maxMemorySize, maxSize, type, algorithm, reference);
                    ((ManagedCache)cache).setCacheConfig(config);

                    cf.addCache(cache);
                }
            }

        } catch (SAXParseException e) {
            String msg = "Parsing error, line " + e.getLineNumber() + ", uri " + e.getSystemId()+"\n"+
View Full Code Here

Examples of net.sf.jsr107cache.CacheFactory

    props.put(GCacheFactory.NAMESPACE, C_NAMESPACE);
//    props.put(GCacheFactory.EXPIRATION_DELTA, C_TIMEOUT);
    CacheManager cMan = CacheManager.getInstance();
    props.put("name", C_NAME);
    try{
      CacheFactory cFac = cMan.getCacheFactory();
      Cache cache = cFac.createCache(props);
      cMan.registerCache(C_NAME, cache);
      cache.put(C_KEY_RESULTS, new Results());
      cache.put(C_KEY_SUMMARY, retrieveSummary());
    }catch(CacheException e){
     
View Full Code Here

Examples of net.sf.swarmcache.CacheFactory

   *
   * @param properties current configuration settings.
   */
  public void start(Properties properties) throws CacheException {
        CacheConfiguration config = CacheConfigurationManager.getConfig(properties);
        factory = new CacheFactory(config);
  }
View Full Code Here

Examples of net.sf.swarmcache.CacheFactory

   *
   * @param properties current configuration settings.
   */
  public void start(Properties properties) throws CacheException {
        CacheConfiguration config = CacheConfigurationManager.getConfig(properties);
        factory = new CacheFactory(config);
  }
View Full Code Here

Examples of org.ajax4jsf.cache.CacheFactory

      // this.cacheAdmin = ServletCacheAdministrator.getInstance(
      // servletContext, cacheProperties);
      try {
        CacheManager cacheManager = CacheManager.getInstance();
        Map env = new ServletContextInitMap(servletContext);
        CacheFactory cacheFactory = cacheManager.getCacheFactory(env);
        this.cache = cacheFactory.createCache(env, this, this);
      } catch (CacheException e) {
        throw new FacesException(e.getMessage(), e);
      }
    }
    // Create Resource-specific Faces Lifecycle instance.
View Full Code Here

Examples of org.ajax4jsf.cache.CacheFactory

   
    public void init(ServletContext servletContext) {
      try {
    CacheManager cacheManager = CacheManager.getInstance();
    Map env = new ServletContextInitMap(servletContext);
    CacheFactory cacheFactory = cacheManager.getCacheFactory(env);
    this.cache = cacheFactory.createCache(env, this, this);
    servletContext.setAttribute(EVENTS_MANAGER_KEY, this);
  } catch (CacheException e) {
    throw new FacesException(e.getMessage(), e);
  }
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.