MemoMemcache

MemoMemcache is the adapter between the Memo library and memcached (specifically Memcachir).

Installation

def deps do
  [
    {:memo_memcache, "~> 1.0.0"}
  ]
end

Use

For the correct use Memcachier must be configured (config/config.exs content):

config :memcachir,
  hosts: System.get_env("MEMCACHE_SERVERS") || "localhost:11211",
  ttl: System.get_env("MEMCACHE_DEFAULT_TTL") || 172_800,
  coder: Memcache.Coder.Erlang,
  auth: {
    :plain,
    System.get_env("MEMCACHE_USERNAME"),
    System.get_env("MEMCACHE_PASSWORD")
  }

then you can use MemoMemcache as a cache in the Memo.memoize:

Memo.memoize(Kernel, :div, [5, 2], cache: MemoMemcache)

License

BSD3


Created: 2018-10-17Z