java - 有没有人在 Hibernate 中使用 Elasticache 作为其二级缓存?

标签 java hibernate amazon-ec2 amazon-elasticache

我发现一些线程说这是可行的,但没有找到具体的说明或配置信息。

我也想从 Beanstalk 做到这一点:应用程序应该部署到 beanstalk,并使用将 hibernate 指向 elasticache 实例的配置。

最佳答案

是的,我们能够使用二级缓存配置 hibernate ..虽然不是使用 beanstalk.. 这段代码应该可以帮助你。

<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 也是

关于java - 有没有人在 Hibernate 中使用 Elasticache 作为其二级缓存?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8765913/

相关文章:

java - ant - 更新任务 : regenerate only outdated files

hibernate - 使用 hibernate 删除多对一

hibernate - 为什么这个值对于我的 H2 表来说太长

eclipse - Amazon EC2- Tomcat 远程调试问题

amazon-web-services - 如何从 EC2 实例下载文件到本地计算机

java - 启动使用 jpackage 创建的已安装可执行文件时出现 ClassNotFoundException

java - java中两个表达式的区别

java - GC 优化 : declaring object as field opposed to declaring it locally

postgresql - PG/hibernate : operator does not exist: character varying = bytea

amazon-web-services - AWS EC2 实例上报告的平均负载是否准确?