Module z_config

Simple configuration server.

Copyright © 2010 Marc Worrell

Behaviours: gen_server.

Authors: Marc Worrell (marc@worrell.nl).

Description

Simple configuration server. Holds and updates the global config in priv/config

Function Index

code_change/3Convert process state when code is changed.
get/1Get value from config file (cached).
get_dirty/1Dirty read of complete config file.
handle_call/3Get a value.
handle_cast/2Set a value.
handle_info/2Handling all non call/cast messages.
init/1Initiates the server.
set/2Set value in config file, update cache.
set_dirty/2Dirty write of config key, updates the config file on disk when the value is changed.
start_link/0Starts the server.
terminate/2This function is called by a gen_server when it is about to terminate.

Function Details

code_change/3

code_change(OldVsn, State, Extra) -> {ok, NewState}

Convert process state when code is changed

get/1

get(Key) -> any()

Get value from config file (cached)

get_dirty/1

get_dirty(Key) -> any()

Dirty read of complete config file

handle_call/3

handle_call(Message::Request, From, State) -> {reply, Reply, State} | {reply, Reply, State, Timeout} | {noreply, State} | {noreply, State, Timeout} | {stop, Reason, Reply, State} | {stop, Reason, State}

Get a value

handle_cast/2

handle_cast(Message, State) -> any()

Set a value

handle_info/2

handle_info(Info, State) -> {noreply, State} | {noreply, State, Timeout} | {stop, Reason, State}

Handling all non call/cast messages

init/1

init(Args) -> {ok, State} | {ok, State, Timeout} | ignore | {stop, Reason}

Initiates the server.

set/2

set(Key, Value) -> any()

Set value in config file, update cache.

set_dirty/2

set_dirty(Key, Value) -> any()

Dirty write of config key, updates the config file on disk when the value is changed

start_link/0

start_link() -> {ok, Pid} | ignore | {error, Error}

Starts the server

terminate/2

terminate(Reason, State) -> void()

This function is called by a gen_server when it is about to terminate. It should be the opposite of Module:init/1 and do any necessary cleaning up. When it returns, the gen_server terminates with Reason. The return value is ignored.


Generated by EDoc, Feb 25 2011, 21:14:41.