我发现一些线程说这是可行的,但是没有找到特定的指令或配置信息。
我也想从Beanstalk中做到这一点:应将应用程序部署到Beanstalk,并使用一个将hibernate状态指向Elasticache实例的配置。
是的,我们能够使用2级缓存配置hibernate状态。虽然没有使用beantalk。此代码应该可以帮助您。
<props> <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> <prop key="hibernate.show_sql">false</prop> <prop key="hibernate.format_sql">false</prop> <prop key="hibernate.generate_statistics">true</prop> <prop key="hibernate.cache.use_structured_entries">true</prop> <!-- prop key="hibernate.hbm2ddl.auto" >update</prop --> <prop key="hibernate.jdbc.batch_size">100</prop> <prop key="hibernate.cache.provider_class">com.googlecode.hibernate.memcached.MemcachedCacheProvider </prop> <!-- Cache disabled --> <prop key="hibernate.cache.use_query_cache">true</prop> <prop key="hibernate.cache.use_second_level_cache">true</prop> <prop key="hibernate.memcached.servers"><elasticachehostname>:11211</prop> <prop key="hibernate.memcached.cacheTimeSeconds">300</prop> <prop key="hibernate.memcached.connectionFactory">DefaultConnectionFactory</prop> <prop key="hibernate.memcached.clearSupported">false</prop> </props>
您还需要hibernate的memcached jar