Skip to content

Commit

Permalink
Merge pull request #14 from dicefm/support-redis-url
Browse files Browse the repository at this point in the history
Support Redix.start_link/2
  • Loading branch information
Shane Kilkelly committed Jul 13, 2019
2 parents ae22bc0 + d7e8ebd commit 2bddb64
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/hammer_backend_redis.ex
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,14 @@ defmodule Hammer.Backend.Redis do
Keyword.get(args, :redis_config, [])
)

{:ok, redix} = Redix.start_link(redix_config)
redis_url = Keyword.get(args, :redis_url, nil)

{:ok, redix} =
if is_binary(redis_url) && byte_size(redis_url) > 0 do
Redix.start_link(redis_url, redix_config)
else
Redix.start_link(redix_config)
end
{:ok, %{redix: redix, expiry_ms: expiry_ms}}
end

Expand Down

0 comments on commit 2bddb64

Please sign in to comment.