Elixir & Phoenix:将 memcache_client 库添加到应用
Elixir & Phoenix: add memcache_client library to app
我想在我的 Phoenix 应用程序中使用这个库来连接到 Memcache:https://github.com/tsharju/memcache_client
当我 运行 我的服务器出现此错误时:
** (exit) exited in: :gen_server.call(Memcache.Client.Pool, {:checkout, #Reference<0.0.1.768>, true}, 5000)
** (EXIT) no process: the process is not alive or there's no process currently associated with the given name, possibly because its application isn't started
:erlang.send(Memcache.Client.Pool, {:"$gen_cast", {:cancel_waiting, #Reference<0.0.1.768>}}, [:noconnect])
我知道有一个文档说:
Also, remember to add :memcache_client to your :applications list if
you wish that the application is started automatically.
但我不明白我应该在我的 Phoenix 应用程序中做什么。有什么帮助吗?谢谢!
在mix.exs
中,将:memcache_client
添加到函数application/0
中的键:applications
:
def application do
[mod: {MyApp, []},
applications: [:phoenix, :phoenix_pubsub, :phoenix_html, :cowboy, :logger, :gettext,
:phoenix_ecto, :postgrex]]
end
->
def application do
[mod: {MyApp, []},
applications: [:phoenix, :phoenix_pubsub, :phoenix_html, :cowboy, :logger, :gettext,
:phoenix_ecto, :postgrex, :memcache_client]]
end
解决了。只需编辑 mix.exs 文件。 returns 应用列表中有一个方法应用:
def application do
[mod: {MyApp, []},
applications: [:phoenix, :phoenix_pubsub, :phoenix_html, :cowboy, :logger, :gettext,
:phoenix_ecto, :postgrex, :memcache_client]] # add memcache_client here
结束
我想在我的 Phoenix 应用程序中使用这个库来连接到 Memcache:https://github.com/tsharju/memcache_client
当我 运行 我的服务器出现此错误时:
** (exit) exited in: :gen_server.call(Memcache.Client.Pool, {:checkout, #Reference<0.0.1.768>, true}, 5000)
** (EXIT) no process: the process is not alive or there's no process currently associated with the given name, possibly because its application isn't started
:erlang.send(Memcache.Client.Pool, {:"$gen_cast", {:cancel_waiting, #Reference<0.0.1.768>}}, [:noconnect])
我知道有一个文档说:
Also, remember to add :memcache_client to your :applications list if you wish that the application is started automatically.
但我不明白我应该在我的 Phoenix 应用程序中做什么。有什么帮助吗?谢谢!
在mix.exs
中,将:memcache_client
添加到函数application/0
中的键:applications
:
def application do
[mod: {MyApp, []},
applications: [:phoenix, :phoenix_pubsub, :phoenix_html, :cowboy, :logger, :gettext,
:phoenix_ecto, :postgrex]]
end
->
def application do
[mod: {MyApp, []},
applications: [:phoenix, :phoenix_pubsub, :phoenix_html, :cowboy, :logger, :gettext,
:phoenix_ecto, :postgrex, :memcache_client]]
end
解决了。只需编辑 mix.exs 文件。 returns 应用列表中有一个方法应用:
def application do
[mod: {MyApp, []},
applications: [:phoenix, :phoenix_pubsub, :phoenix_html, :cowboy, :logger, :gettext,
:phoenix_ecto, :postgrex, :memcache_client]] # add memcache_client here
结束