Skip to content

Commit

Permalink
Fix cache setup
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljguarino committed Jan 7, 2023
1 parent e2685a9 commit 5b0909e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
1 change: 0 additions & 1 deletion apps/core/lib/core/clients/hydra.ex
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ defmodule Core.Clients.Hydra do
]
end

@duration 60 * 60 * 24

def get_configuration() do
public_url("/.well-known/openid-configuration")
Expand Down
2 changes: 1 addition & 1 deletion apps/core/lib/core/guardian.ex
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ defmodule Core.Guardian do
end
def resource_from_claims(_claims), do: {:error, :not_authorized}

@decorate cacheable(cache: Core.Cache, key: {:login_v2, id}, opts: [ttl: @ttl], match: &allow/1)
@decorate cacheable(cache: Core.Cache, key: {:login, id}, opts: [ttl: @ttl], match: &allow/1)
def fetch_user(id) do
Users.get_user(id)
|> Core.Services.Rbac.preload()
Expand Down
14 changes: 12 additions & 2 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,25 @@ config :core, Core.Email.Mailer,

config :core, Core.PartitionedCache,
primary: [
gc_interval: :timer.seconds(3600),
gc_interval: :timer.hours(1),
backend: :shards,
partitions: 2,
allocated_memory: 1000 * 1000 * 500
]

config :core, Core.Cache,
local: Core.Cache.Local,
node_selector: Nebulex.Adapters.Dist
node_selector: Nebulex.Adapters.Dist,
primary: [
gc_interval: :timer.hours(1),
backend: :shards,
partitions: 2,
allocated_memory: 1000 * 1000 * 500
],
gc_interval: :timer.hours(1),
backend: :shards,
partitions: 2,
allocated_memory: 1000 * 1000 * 500

config :core, Core.Conduit.Broker,
adapter: ConduitAMQP,
Expand Down

0 comments on commit 5b0909e

Please sign in to comment.