Permalink
Browse files

converts phpcask to an erlang App

  • Loading branch information...
1 parent 3abdc6e commit 2c5aadcc07ac47f3f918e66858ff229a14350104 @videlalvaro committed May 12, 2010
Showing with 53 additions and 0 deletions.
  1. +25 −0 ebin/phpcask.app
  2. +11 −0 src/phpcask_app.erl
  3. +17 −0 src/phpcask_sup.erl
View
@@ -0,0 +1,25 @@
+{application, phpcask,
+ [
+ {description, ""},
+ {vsn, "0.1"},
+ {modules, [
+ phpcask,
+ phpcask_app,
+ phpcask_sup
+ ]},
+ {registered, []},
+ {applications, [
+ kernel,
+ stdlib
+ ]},
+ {mod, {phpcask_app, []}},
+ {env, [
+
+ %% Default folder to store bitcask files.
+ {dirname, "./priv/data"},
+
+ %% Expiration time in seconds for the session data.
+ {expiry_secs, 900}
+
+ ]}
+ ]}.
View
@@ -0,0 +1,11 @@
+-module(phpcask_app).
+
+-behaviour(application).
+
+-export([start/2, stop/1]).
+
+start(_StartType, _StartArgs) ->
+ phpcask_sup:start_link().
+
+stop(_State) ->
+ ok.
View
@@ -0,0 +1,17 @@
+%% based on bitcask supervisor code %%
+
+-module(phpcask_sup).
+
+-behaviour(supervisor).
+
+-export([start_link/0]).
+
+-export([init/1]).
+
+-define(CHILD(I, Type), {I, {I, start_link, []}, permanent, 5000, Type, [I]}).
+
+start_link() ->
+ supervisor:start_link({local, ?MODULE}, ?MODULE, []).
+
+init([]) ->
+ {ok, {{one_for_one, 5, 10}, [?CHILD(phpcask, worker)]}}.

0 comments on commit 2c5aadc

Please sign in to comment.