From 2273ff20faa24a0daba4e4b43ace250716a39172 Mon Sep 17 00:00:00 2001 From: nsensfel Date: Tue, 28 Nov 2017 21:07:34 +0100 Subject: Homogenizes the modules' presentation. --- src/io/timed_cache.erl | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'src/io/timed_cache.erl') diff --git a/src/io/timed_cache.erl b/src/io/timed_cache.erl index c86caab..ec93a48 100644 --- a/src/io/timed_cache.erl +++ b/src/io/timed_cache.erl @@ -1,7 +1,14 @@ -module(timed_cache). -behavior(gen_server). -%%%% gen_server exports +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% EXPORTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%% 'gen_server' Exports -export ( [ @@ -15,7 +22,7 @@ ] ). -%%%% actual interface +%%%% Actual Interface -export ( [ @@ -25,7 +32,7 @@ ). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% LOCAL %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% add_to_cache (DB, ObjectID) -> {ok, TimerPID} = gen_server:start(?MODULE, {DB, ObjectID}, []), @@ -34,10 +41,9 @@ add_to_cache (DB, ObjectID) -> Data. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% EXPORTED %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%% gen_server - +%%%% 'gen_server' functions init ({DB, ObjectID}) -> {ok, {DB, ObjectID}}. @@ -65,7 +71,7 @@ handle_info(timeout, State) -> handle_info(_, {DB, ObjectID}) -> {noreply, {DB, ObjectID}, timed_caches_manager:get_timeout(DB)}. -%%%% interface +%%%% Interface Functions fetch (DB, ObjectID) -> io:format("~nfetch from cache: ~p.~n", [{DB, ObjectID}]), case ets:lookup(DB, ObjectID) of -- cgit v1.2.3-70-g09d2