Examples of CacheService


Examples of ch.entwine.weblounge.cache.CacheService

    ServiceRegistration registration = services.remove(pid);
    if (registration == null) {
      logger.debug("Cache service with pid '{}' was never registered and can therefore not be deleted", pid);
      return;
    }
    CacheService cache = (CacheService) bundleCtx.getService(registration.getReference());
    try {
      registration.unregister();
    } catch (IllegalStateException e) {
      // Never mind, the service has been unregistered already
    } catch (Throwable t) {
      logger.error("Unregistering cache service failed: {}", t.getMessage());
    }
    cache.shutdown();
  }
View Full Code Here

Examples of com.alibaba.dubbo.examples.cache.api.CacheService

    public static void main(String[] args) throws Exception {
        String config = CacheConsumer.class.getPackage().getName().replace('.', '/') + "/cache-consumer.xml";
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(config);
        context.start();
       
        CacheService cacheService = (CacheService)context.getBean("cacheService");

        // 测试缓存生效,多次调用返回同样的结果。(服务器端自增长返回值)
        String fix = null;
        for (int i = 0; i < 5; i ++) {
            String result = cacheService.findCache("0");
            if (fix == null || fix.equals(result)) {
                System.out.println("OK: " + result);
            } else {
                System.err.println("ERROR: " + result);
            }
            fix = result;
            Thread.sleep(500);
        }
       
        // LRU的缺省cache.size为1000,执行1001次,应有溢出
        for (int n = 0; n < 1001; n ++) {
            String pre = null;
            for (int i = 0; i < 10; i ++) {
                String result = cacheService.findCache(String.valueOf(n));
                if (pre != null && ! pre.equals(result)) {
                    System.err.println("ERROR: " + result);
                }
                pre = result;
            }
        }
       
        // 测试LRU有移除最开始的一个缓存项
        String result = cacheService.findCache("0");
        if (fix != null && ! fix.equals(result)) {
            System.out.println("OK: " + result);
        } else {
            System.err.println("ERROR: " + result);
        }
View Full Code Here

Examples of com.commafeed.backend.cache.CacheService

  }

  private void testOpmlVersion(String fileName) throws IOException {
    FeedCategoryDAO feedCategoryDAO = Mockito.mock(FeedCategoryDAO.class);
    FeedSubscriptionService feedSubscriptionService = Mockito.mock(FeedSubscriptionService.class);
    CacheService cacheService = Mockito.mock(CacheService.class);
    User user = Mockito.mock(User.class);

    String xml = IOUtils.toString(getClass().getResourceAsStream(fileName));

    OPMLImporter importer = new OPMLImporter(feedCategoryDAO, feedSubscriptionService, cacheService);
View Full Code Here

Examples of com.hazelcast.cache.impl.CacheService

    }

    @Override
    public void run()
            throws Exception {
        final CacheService service = getService();
        CacheConfig cacheConfig = service.getCacheConfig(name);
        if (register) {
            //REGISTER
            if (cacheConfig == null) {
                throw new IllegalStateException("CacheConfig does not exist!!! name: " + name);
            }
View Full Code Here

Examples of com.netflix.staash.service.CacheService

      PaasDataService datasvc = new PaasDataService(metasvc, fac);
        return datasvc;
    }
    @Provides
    CacheService provideCacheService(@Named("newmetadao") MetaDao metad) {
        return new CacheService(metad);
    }
View Full Code Here

Examples of com.netflix.staash.service.CacheService

        PaasDataService datasvc = new PaasDataService(metasvc, fac);
        return datasvc;
    }
    @Provides
    CacheService provideCacheService(@Named("newmetadao") MetaDao metad) {
        return new CacheService(metad);
    }
View Full Code Here

Examples of com.netflix.staash.service.CacheService

        PaasDataService datasvc = new PaasDataService(metasvc, fac);
        return datasvc;
    }
    @Provides
    CacheService provideCacheService(@Named("newmetadao") MetaDao metad) {
        return new CacheService(metad);
    }
View Full Code Here

Examples of com.tangosol.net.CacheService

      typeMap = CacheFactory.getCache(AUTO_POF_MAPPING);
    }
    else {
      Cluster cluster = CacheFactory.getCluster();
      if (cluster.getServiceInfo(AUTO_POF_SERVICE) != null) {
        CacheService service = (CacheService) cluster.getService(AUTO_POF_SERVICE);
        typeMap = service.ensureCache(AUTO_POF_MAPPING, null);
      }
      else {
        XmlElement xml = XmlHelper.loadXml(XML_FRAGMENT);
        typeMap = new DefaultConfigurableCacheFactory(xml).ensureCache(AUTO_POF_MAPPING, null);
      }
View Full Code Here

Examples of com.tangosol.net.CacheService

         return Collections.singletonMap(nc.getCacheName(), getOwnedSize());
      }

      @Override
      public int getNumReplicas() {
         CacheService service = nc.getCacheService();
         if (service instanceof PartitionedService) {
            return ((PartitionedService) service).getBackupCount() + 1;
         } else if (service instanceof ReplicatedCache) {
            return service.getCluster().getMemberSet().size();
         } else {
            return 1;
         }
      }
View Full Code Here

Examples of net.sf.jportlet.service.cache.CacheService

    {
        if ( _cacheRegion == null )
        {
            synchronized ( this )
            {
                CacheService cacheService = ( CacheService ) getPortletContext(  ).getService( CacheService.NAME );
                _cacheRegion = cacheService.getRegion( _cacheRegionId, true );
            }
        }

        return _cacheRegion;
    }
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.