Package com.avaje.ebean.cache

Examples of com.avaje.ebean.cache.ServerCacheManager


    Assert.assertEquals(0, countryCache.size());

    Ebean.runCacheWarming(Country.class);
    Assert.assertTrue(countryCache.size() > 0);

    ServerCacheManager serverCacheManager = Ebean.getServerCacheManager();
    serverCacheManager.clearAll();
    Assert.assertEquals(0, countryCache.size());

    Ebean.runCacheWarming(Country.class);
    Assert.assertTrue(countryCache.size() > 0);
View Full Code Here


  @Test
  public void testLazyLoadOnRef() {

    ResetBasicData.reset();

    ServerCacheManager serverCacheManager = Ebean.getServerCacheManager();
    boolean originallyBeanCaching = serverCacheManager.isBeanCaching(Customer.class);

    Customer customer = Ebean.getReference(Customer.class, 1);

    // invoke lazy loading
    customer.getName();

    if (!originallyBeanCaching) {
      // the lazy loading shouldn't start the L2 bean cache
      boolean beanCachingAfter = serverCacheManager.isBeanCaching(Customer.class);
      Assert.assertFalse(beanCachingAfter);
    }
  }
View Full Code Here

     
    Assert.assertNotNull(billAddress);
    Assert.assertEquals("3 Pineapple St", billAddress.getStreet());
  
    EbeanServer server = Ebean.getServer(null);
    ServerCacheManager serverCacheManager = server.getServerCacheManager();
   
    // get cache, clear the cache and statistics
    ServerCache beanCache = serverCacheManager.getBeanCache(EInvoice.class);
    beanCache.clear();
    beanCache.getStatistics(true);
   
    // fetch and load the cache
    EInvoice invoice4 = Ebean.find(EInvoice.class)
View Full Code Here

    String[] names = "A,B,C,D,E,F,G,H,I,J".split(",");
    for (int i = 0; i < names.length; i++) {
      inserted.add(insert(names[i]));
    }
   
    ServerCacheManager serverCacheManager = Ebean.getServerCacheManager();
    serverCacheManager.setCaching(UUOne.class, true);
   
    UUOne b = Ebean.find(UUOne.class)
      .setId(inserted.get(1).getId())
      .setUseCache(true)
      .findUnique();
View Full Code Here

    Assert.assertNotNull(cacheOptions);
    Assert.assertTrue(cacheOptions.isUseCache());
    Assert.assertTrue(cacheOptions.isReadOnly());
    Assert.assertTrue(beanDescriptor.isCacheSharableBeans());

    ServerCacheManager serverCacheManager = server.getServerCacheManager();
    serverCacheManager.clear(Country.class);

    ServerCache beanCache = serverCacheManager.getBeanCache(Country.class);
    Assert.assertEquals(0, beanCache.size());

    Country nz1 = Ebean.getReference(Country.class, "NZ");
    Assert.assertEquals(0, beanCache.size());
View Full Code Here

      }

      // inform the NamingConvention of the associated DatabasePlaform
      serverConfig.getNamingConvention().setDatabasePlatform(serverConfig.getDatabasePlatform());

      ServerCacheManager cacheManager = getCacheManager(serverConfig);

      int uniqueServerId = serverId.incrementAndGet();
      SpiBackgroundExecutor bgExecutor = createBackgroundExecutor(serverConfig, uniqueServerId);

      InternalConfiguration c = new InternalConfiguration(xmlConfig, clusterManager, cacheManager, bgExecutor, serverConfig, bootupClasses,
          pstmtBatch);

      DefaultServer server = new DefaultServer(c, cacheManager);

      cacheManager.init(server);

      MBeanServer mbeanServer;
      ArrayList<?> list = MBeanServerFactory.findMBeanServer(null);
      if (list.size() == 0) {
        // probably not running in a server
View Full Code Here

  /**
   * Create and return the CacheManager.
   */
  private ServerCacheManager getCacheManager(ServerConfig serverConfig) {

    ServerCacheManager serverCacheManager = serverConfig.getServerCacheManager();
    if (serverCacheManager != null) {
      return serverCacheManager;
    }

    // reasonable default settings are for a cache per bean type
View Full Code Here

 
  private void init() {
   
    ResetBasicData.reset();
   
    ServerCacheManager serverCacheManager = Ebean.getServer(null).getServerCacheManager();
    serverCacheManager.clearAll();
    serverCacheManager.setCaching(Order.class, false);   
  }
View Full Code Here

TOP

Related Classes of com.avaje.ebean.cache.ServerCacheManager

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.