Skip to content

Commit

Permalink
fix: make redis uri workable to allow for updates to redix
Browse files Browse the repository at this point in the history
  • Loading branch information
MikaAK committed Jul 3, 2023
1 parent c2de6c5 commit f5596f7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/cache/redis/global.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,32 @@ defmodule Cache.Redis.Global do
end

def command(pool_name, command, opts \\ []) do
opts = Keyword.delete(opts, :uri)

:poolboy.transaction(pool_name, fn pid ->
pid |> Redix.command(command, opts) |> handle_response
end)
end

def command!(pool_name, command, opts \\ []) do
opts = Keyword.delete(opts, :uri)

:poolboy.transaction(pool_name, fn pid ->
Redix.command!(pid, command, opts)
end)
end

def pipeline(pool_name, commands, opts \\ []) do
opts = Keyword.delete(opts, :uri)

:poolboy.transaction(pool_name, fn pid ->
pid |> Redix.pipeline(commands, opts) |> handle_response
end)
end

def pipeline!(pool_name, commands, opts \\ []) do
opts = Keyword.delete(opts, :uri)

:poolboy.transaction(pool_name, fn pid ->
Redix.pipeline!(pid, commands, opts)
end)
Expand All @@ -38,6 +46,7 @@ defmodule Cache.Redis.Global do

with {:ok, elements} <- scan_and_paginate(pool_name, "SCAN", nil, 0, match, count, type) do
keys = Enum.map(elements, &String.replace_leading(&1, "#{pool_name}:", ""))

{:ok, keys}
end
end
Expand Down

0 comments on commit f5596f7

Please sign in to comment.