Packages

A method caching macro for elixir using CAS on ETS, a fork of memoize

Current section

Files

Jump to
ditto lib ditto application.ex
Raw

lib/ditto/application.ex

defmodule Ditto.Application do
@moduledoc false
@behaviour Application
@behaviour Supervisor
@cache_strategy Application.get_env(:ditto, :cache_strategy, Ditto.CacheStrategy.Default)
def start(_type, _args) do
Supervisor.start_link(__MODULE__, [], strategy: :one_for_one, name: __MODULE__)
end
def stop(_state) do
:ok
end
def init(_opts) do
caches = Application.get_env(:ditto, :caches)
@cache_strategy.init(caches: caches)
Supervisor.init([], strategy: :one_for_one)
end
def cache_strategy() do
@cache_strategy
end
end