Packages

High performance embedded realtime database combining ETS with TTL for caching, RocksDB for persistent parallel writes, and SQLite for secondary indexing and fast lookups

Current section

Files

Jump to
kdb lib scheduler.ex
Raw

lib/scheduler.ex

defmodule Kdb.Scheduler do
@cleanup_interval :timer.minutes(15)
use Poolder.Scheduler,
hibernate_after: :timer.seconds(60),
jobs: [
{:cleanup, @cleanup_interval}
]
def cleanup(_args) do
# name = Keyword.fetch!(args.opts, :name)
time = :os.system_time(:milliseconds)
total = Kdb.Cache.cleanup(time)
IO.puts("Cleaned up #{total} entries")
:ok
end
end