简体   繁体   English

redis-rails和connection_pool的问题

[英]Issues with redis-rails and connection_pool

How I can initialize my redis_store to have connection pooling. 如何初始化redis_store以具有连接池。 I want to add pooling attributes { pool_size: 10, pool_timeout: 10 } I have added connection_pool gem 我想添加池属性{pool_size:10,pool_timeout:10}我添加了connection_pool gem

Example::Application.config.session_store :redis_store,
                                      servers: { host:      'localhost',
                                                 port:      6379,
                                                 db:        0,
                                                 namespace: 'session'
                                      },
                                      expires_in: 25.hours,

It gives error on server boot. 它在服务器启动时给出错误。 If I add something like below; 如果我添加如下内容;

Example::Application.config.session_store :redis_store,
                                      servers: { host:      'localhost',
                                                 port:      6379,
                                                 db:        0,
                                                 namespace: 'session'
                                      },
                                      expires_in: 25.hours,
                                      { pool_size: 10, pool_timeout: 10 }

After I'd executed your code, I've run into a simple SyntaxError . 执行SyntaxError代码后,我遇到了一个简单的SyntaxError Might be your problem, since the correct specifying of the options should be: 可能是您的问题,因为正确指定选项应该是:

Example::Application.config.session_store :redis_store,
                                      servers: { host:      'localhost',
                                                 port:      6379,
                                                 db:        0,
                                                 namespace: 'session'
                                      },
                                      expires_in: 25.hours,
                                      pool_size: 10,
                                      pool_timeout: 10

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM