Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- brandCache - [ name = brandCache cacheHits = 0 onDiskHits = 0 offHeapHits = 0 inMemoryHits = 0 misses = 0 onDiskMisses = 0 offHeapMisses = 0 inMemoryMisses = 0 size = 0 averageGetTime = 0.0 evictionCount = 0 ]
- Statistics[start time=1511262597502,sessions opened=4,sessions closed=3,transactions=3,successful transactions=3,optimistic lock failures=0,flushes=9,connections obtained=4,statements prepared=132,statements closed=0,second level cache puts=0,second level cache hits=0,second level cache misses=0,entities loaded=6622,entities updated=15,entities inserted=15,entities deleted=0,entities fetched=1,collections loaded=27,collections updated=0,collections removed=3,collections recreated=3,collections fetched=27,naturalId queries executed to database=0,naturalId cache puts=0,naturalId cache hits=0,naturalId cache misses=0,naturalId max query time=0,queries executed to database=54,query cache puts=0,query cache hits=0,query cache misses=0,update timestamps cache puts=53,update timestamps cache hits=0,update timestamps cache misses=0,max query time=31113
- 21-Nov-17 11:08 0 .ehcache-diskstore.lock
- 21-Nov-17 11:52 0 brand%0043ache.data
- <bean id="viapromDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
- destroy-method="close">
- <property name="driverClass" value="com.mysql.jdbc.Driver" />
- <property name="jdbcUrl" value="${viaprom.data.db.url}" />
- <property name="user" value="${viaprom.data.db.username}" />
- <property name="password" value="${viaprom.data.db.password}" />
- <!-- these are C3P0 properties -->
- <property name="initialPoolSize" value="100" />
- <property name="acquireIncrement" value="5" />
- <property name="minPoolSize" value="5" />
- <property name="maxPoolSize" value="200" />
- <property name="maxIdleTime" value="7200" />
- <property name="checkoutTimeout" value="1000" />
- <property name="automaticTestTable" value="C3P0_TEST_TABLE"></property>
- <property name="testConnectionOnCheckin" value="true"></property>
- <property name="idleConnectionTestPeriod" value="60"></property>
- </bean>
- <bean id="viaPromSessionFactory"
- class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
- <property name="dataSource" ref="viapromDataSource" />
- <property name="configLocation" value="classpath:hibernate_viaprom_mappings.cfg.xml" />
- <property name="hibernateProperties">
- <props>
- <prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
- <prop key="hibernate.show_sql">true</prop>
- <prop key="hibernate.cache.use_second_level_cache">true</prop>
- <prop key="hibernate.cache.use_query_cache">true</prop>
- <prop key="hibernate.generate_statistics">true</prop>
- <prop key="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</prop>
- <!-- <prop key="connection.pool_size">10</prop> -->
- <!-- <prop key="hibernate.current_session_context_class">org.springframework.orm.hibernate4.SpringSessionContext</prop> -->
- </props>
- </property>
- </bean>
- <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager">
- <property name="cacheManager" ref="ehcache" />
- </bean>
- <bean id="ehcache"
- class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
- <property name="configLocation" value="classpath:/ehcache.xml" />
- <property name="shared" value="true" />
- </bean>
- <ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:noNamespaceSchemaLocation="ehcache.xsd" updateCheck="true"
- monitoring="autodetect" dynamicConfig="true">
- <diskStore path="java.io.tmpdir/ehcache" />
- <defaultCache
- maxElementsInMemory="10000"
- eternal="false"
- timeToIdleSeconds="150"
- timeToLiveSeconds="120"
- overflowToDisk="true"
- diskPersistent="false"
- diskExpiryThreadIntervalSeconds="120"
- memoryStoreEvictionPolicy="LRU" statistics="true" />
- <cache name="brandCache" statistics="true" maxElementsInMemory="100" eternal="true" overflowToDisk="true" />
- </ehcache>
- @Cacheable(value="brandCache", key="T(java.util.Objects).hash(#brand)")
- public ProductBrandDTO getProductBrand(String brand) {
- ProductBrandDTO productBrand = null;
- try {
- log.debug("brand {} " , brand );
- Session session = viaPromSessionFactory.getCurrentSession();
- Criteria criteria = session.createCriteria(ProductBrandDTO.class, "productBrand");
- criteria.add(Restrictions.eqOrIsNull("productBrand.brandName", StringUtils.trimToNull(brand)));
- productBrand = (ProductBrandDTO) criteria.uniqueResult();
- if (productBrand == null) {
- productBrand = new ProductBrandDTO();
- productBrand.setBrandName(brand);
- session.saveOrUpdate(productBrand);
- }
- } catch (Exception e) {
- log.error(e.getMessage(),e);
- }
- return productBrand;
- }
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-ehcache</artifactId>
- <version>4.3.5.Final</version>
- </dependency>
- <properties>
- <spring.version>4.0.5.RELEASE</spring.version>
- <jackson.version>2.4.4</jackson.version>
- <hibernate.version>4.3.5.Final</hibernate.version>
- <log4j.version>1.2.17</log4j.version>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <springframework.version>4.3.1.RELEASE</springframework.version>
- <springsecurity.version>4.1.1.RELEASE</springsecurity.version>
- <jackson.library>2.7.5</jackson.library>
- <org.aspectj-version>1.7.4</org.aspectj-version>
- <java.mail.version>1.4.7</java.mail.version>
- <commons.logging.version>1.2</commons.logging.version>
- <!-- SLF4J -->
- <slf4j.version>1.7.5</slf4j.version>
- <!-- Log4j 2 -->
- <log4j2.version>2.2</log4j2.version>
- <!-- Log4j -->
- <log4j.version>1.2.17</log4j.version>
- </properties>
Add Comment
Please, Sign In to add comment