Memcache.cas

You're seeing just the function cas, go back to Memcache module for more information.
Link to this function

cas(server, key, update, opts \\ [])

View Source

Specs

cas(GenServer.server(), binary(), (value() -> value()), Keyword.t()) ::
  {:ok, any()} | error()

Compare and swap value using optimistic locking.

  1. Get the existing value for key
  2. If it exists, call the update function with the value
  3. Set the returned value for key

The 3rd operation will fail if someone else has updated the value for the same key in the mean time. In that case, by default, this function will go to step 1 and try again. Retry behavior can be disabled by passing [retry: false] option.