1 defmodule Pleroma.Migrators.HashtagsTableMigrator.State do
7 Agent.start_link(fn -> @init_state end, name: __MODULE__)
11 Agent.get(__MODULE__, & &1)
14 def put(key, value) do
15 Agent.update(__MODULE__, fn state ->
16 Map.put(state, key, value)
20 def increment(key, increment \\ 1) do
21 Agent.update(__MODULE__, fn state ->
22 updated_value = (state[key] || 0) + increment
23 Map.put(state, key, updated_value)