Skip to content

Instantly share code, notes, and snippets.

View no-longer-on-githu-b's full-sized avatar

no longer on github no-longer-on-githu-b

View GitHub Profile

I'm a fucking retard. File descriptors are magic. Yay! I know how to do the scheduling in Kreeft! Thank you epoll for being thread-safe. epoll_ctl changes stuff. :v Hmm. ivykis looks cooler as it can be used with kqueue as well.. Oh wait beh callback-based. Monocles are cool.

defmodule Session do
def get key, req do
case :cowboy_req.cookie "session_id", req do
{ :undefined, req } -> { nil, req }
{ session_id, req } ->
case :gen_server.call SessionStore, { :get, session_id, key } do
{ :ok, value } -> { value, req }
nil -> { nil, req }
end