gpt4 book ai didi

redis - Chicago_boss 和 redis 配置

转载 作者:可可西里 更新时间:2023-11-01 11:21:35 25 4
gpt4 key购买 nike

我正在寻找为 Redis 配置芝加哥老板应用程序。我正在使用 eredis gem ( https://github.com/wooga/eredis )。有没有办法从我的 boss.config 中做到这一点?

最佳答案

如果你想在 CB 中使用 eredis 进行缓存,我有个坏消息要告诉你。根据documentation :

At present only Memcached cache servers are supported,
but additional adapters will be added in the future.

但是,如果您想在应用程序中将 eredis 用于其他用途,则根据 eredis docs您需要在启动时提供详细信息:

To start the client, use any of the eredis:start_link/0,1,2,3,4,5 functions. They all include sensible defaults. start_link/5 takes the following arguments:

Host, dns name or ip adress as string
Port, integer, default is 6379
Database, integer or 0 for default database
Password, string or empty string([]) for no password
Reconnect sleep, integer of milliseconds to sleep between reconnect attempts

如果您不想在启动应用程序的代码中硬编码这些值,您可以在 boss.config 中提供它们:

{ your_app_name, [
{eredis_host, "some.host.name"},
{eredis_port, 1234},
...
]}

然后,在您的代码中,您可以使用 EredisHost = application:get_env(your_app_name, eredis_host) 获取主机名并在启动期间使用它。

关于redis - Chicago_boss 和 redis 配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28100442/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com