Permalink
Browse files

Convert cast back to call

  • Loading branch information...
chrismcg committed Nov 11, 2014
1 parent d6a4d27 commit 790541ba42df1acc20be80e619cf944ace0e1ec7
Showing with 2 additions and 2 deletions.
  1. +2 −2 apps/simple_cache/lib/simple_cache/element.ex
@@ -24,7 +24,7 @@ defmodule SimpleCache.Element do

def replace(pid, value), do: GenServer.cast(pid, { :replace, value })

def delete(pid), do: GenServer.cast(pid, :delete)
def delete(pid), do: GenServer.call(pid, :delete)

## Callbacks

@@ -53,7 +53,7 @@ defmodule SimpleCache.Element do
{ :reply, { :ok, value }, state, time_left(start_time, lease_time) }
end

def handle_cast(:delete, state), do: { :stop, :normal, state }
def handle_call(:delete, _from, state), do: { :stop, :normal, :ok, state }

def handle_cast({:replace, value}, %State{start_time: start_time, lease_time: lease_time} = state) do
{ :noreply, %{state | value: value}, time_left(start_time, lease_time) }

0 comments on commit 790541b

Please sign in to comment.