Examples of CacheOptions


Examples of com.avaje.ebeaninternal.server.core.CacheOptions

    }
  }

  private void readCacheStrategy(CacheStrategy cacheStrategy, CacheTuning cacheTuning) {

    CacheOptions cacheOptions = descriptor.getCacheOptions();
    if (cacheTuning != null) {
      cacheOptions.setMaxSecsToLive(cacheTuning.maxSecsToLive());
      cacheOptions.setMaxIdleSecs(cacheTuning.maxIdleSecs());
    }
    if (cacheStrategy != null) {
      cacheOptions.setUseCache(cacheStrategy.useBeanCache());
      cacheOptions.setReadOnly(cacheStrategy.readOnly());
      cacheOptions.setWarmingQuery(cacheStrategy.warmingQuery());
      if (cacheStrategy.naturalKey().length() > 0) {
        String propName = cacheStrategy.naturalKey().trim();
        DeployBeanProperty beanProperty = descriptor.getBeanProperty(propName);
        if (beanProperty != null) {
          beanProperty.setNaturalKey(true);
          cacheOptions.setNaturalKey(propName);
        }
      }
    }
  }
View Full Code Here

Examples of com.avaje.ebeaninternal.server.core.CacheOptions

    ResetBasicData.reset();

    SpiEbeanServer server = (SpiEbeanServer) Ebean.getServer(null);
    BeanDescriptor<Country> beanDescriptor = server.getBeanDescriptor(Country.class);
    CacheOptions cacheOptions = beanDescriptor.getCacheOptions();

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

    ServerCacheManager serverCacheManager = server.getServerCacheManager();
    serverCacheManager.clear(Country.class);
View Full Code Here

Examples of org.qi4j.api.cache.CacheOptions

                    {
                        public void visitMap( MapEntityStore.MapChanger changer )
                                throws IOException
                        {
                            DefaultEntityStoreUnitOfWork uow = (DefaultEntityStoreUnitOfWork) unitOfWork;
                            CacheOptions options = uow.usecase().metaInfo( CacheOptions.class );
                            if( options == null )
                            {
                                options = CacheOptions.ALWAYS;
                            }

                            for( EntityState entityState : state )
                            {
                                JSONEntityState state = (JSONEntityState) entityState;
                                if( state.status().equals( EntityStatus.NEW ) )
                                {
                                    Writer writer = changer.newEntity( state.identity(),
                                            state.entityDescriptor() );
                                    writeEntityState( state, writer, unitOfWork.identity(), unitOfWork.currentTime() );
                                    writer.close();
                                    if( options.cacheOnNew() )
                                    {
                                        cache.put( state.identity().identity(), new CacheState(state.state()) );
                                    }
                                } else if( state.status().equals( EntityStatus.UPDATED ) )
                                {
                                    Writer writer = changer.updateEntity( state.identity(),
                                            state.entityDescriptor() );
                                    writeEntityState( state, writer, unitOfWork.identity(), unitOfWork.currentTime() );
                                    writer.close();
                                    if( options.cacheOnWrite() )
                                    {
                                        cache.put( state.identity().identity(), new CacheState(state.state()) );
                                    }
                                } else if( state.status().equals( EntityStatus.REMOVED ) )
                                {
View Full Code Here

Examples of org.qi4j.api.cache.CacheOptions

        return null;
    }

    private boolean doCacheOnRead( DefaultEntityStoreUnitOfWork unitOfWork )
    {
        CacheOptions cacheOptions = (unitOfWork).usecase().metaInfo( CacheOptions.class );
        return cacheOptions == null || cacheOptions.cacheOnRead();
    }
View Full Code Here

Examples of org.qi4j.api.cache.CacheOptions

                        @Override
                        public void visitMap( MapEntityStore.MapChanger changer )
                            throws IOException
                        {
                            DefaultEntityStoreUnitOfWork uow = (DefaultEntityStoreUnitOfWork) unitOfWork;
                            CacheOptions options = uow.usecase().metaInfo( CacheOptions.class );
                            if( options == null )
                            {
                                options = CacheOptions.ALWAYS;
                            }

                            for( EntityState entityState : state )
                            {
                                JSONEntityState state = (JSONEntityState) entityState;
                                if( state.status().equals( EntityStatus.NEW ) )
                                {
                                    try( Writer writer = changer.newEntity( state.identity(), state.entityDescriptor() ) )
                                    {
                                        writeEntityState( state, writer, unitOfWork.identity(), unitOfWork.currentTime() );
                                    }
                                    if( options.cacheOnNew() )
                                    {
                                        cache.put( state.identity().identity(), new CacheState( state.state() ) );
                                    }
                                }
                                else if( state.status().equals( EntityStatus.UPDATED ) )
                                {
                                    try( Writer writer = changer.updateEntity( state.identity(), state.entityDescriptor() ) )
                                    {
                                        writeEntityState( state, writer, unitOfWork.identity(), unitOfWork.currentTime() );
                                    }
                                    if( options.cacheOnWrite() )
                                    {
                                        cache.put( state.identity().identity(), new CacheState( state.state() ) );
                                    }
                                }
                                else if( state.status().equals( EntityStatus.REMOVED ) )
View Full Code Here

Examples of org.qi4j.api.cache.CacheOptions

        return null;
    }

    private boolean doCacheOnRead( DefaultEntityStoreUnitOfWork unitOfWork )
    {
        CacheOptions cacheOptions = unitOfWork.usecase().metaInfo( CacheOptions.class );
        return cacheOptions == null || cacheOptions.cacheOnRead();
    }
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.