leo_dcerl_server

The disc cache’s server.

Behaviours: `gen_server <gen_server.html>`__.

Description

The disc cache’s server

Function Index

code_change/3 Convert process state when code is changed.
delete/2 Remove a key-value pair by a specified key into the leo_dcerl.
get/2 Retrieve a value associated with a specified key.
get/3 Retrieve a value associated with a specified key.
get_filepath/2 Retrieve a value associated with a specified key.
get_ref/2 Retrieve a reference.
handle_call/3 gen_server callback - Module:handle_call(Request, From, State) -> Result.
handle_cast/2 Handling cast message.
handle_info/2 Handling all non call/cast messages.
init/1 Initiates the server.
items/1 Return server’s items.
put/3 Insert a key-value pair into the leo_dcerl.
put/4  
put_begin_tran/2 Start transaction of insert chunked objects.
put_end_tran/5 End transaction of insert chunked objects.
size/1 Return server’s summary of cache size.
start_link/5 Starts the server.
stats/1 Return server’s state.
stop/1 Manually stops the server.
terminate/2 This function is called by a gen_server when it is about to terminate.

Function Details

code_change/3

code_change(OldVsn, State, Extra) -> any()

Convert process state when code is changed

delete/2

delete(Id, Key) -> ok | {error, any()}

  • Id = atom()
  • Key = binary()

Remove a key-value pair by a specified key into the leo_dcerl

get/2

get(Id, Key) -> undefined | binary() | {error, any()}

  • Id = atom()
  • Key = binary()

Retrieve a value associated with a specified key

get/3

get(Id, Ref, Key) -> undefined | binary() | {error, any()}

  • Id = atom()
  • Ref = any()
  • Key = binary()

Retrieve a value associated with a specified key

get_filepath/2

get_filepath(Id, Key) -> undefined | #cache_meta{} | {error, any()}

  • Id = atom()
  • Key = binary()

Retrieve a value associated with a specified key

get_ref/2

get_ref(Id, Key) -> undefined | binary() | {error, any()}

  • Id = atom()
  • Key = binary()

Retrieve a reference

handle_call/3

handle_call(Request, From, State) -> any()

gen_server callback - Module:handle_call(Request, From, State) -> Result

handle_cast/2

handle_cast(Msg, State) -> any()

Handling cast message

gen_server callback - Module:handle_cast(Request, State) -> Result.

handle_info/2

handle_info(Info, State) -> any()

Handling all non call/cast messages

gen_server callback - Module:handle_info(Info, State) -> Result.

init/1

init(X1) -> any()

Initiates the server

items/1

items(Id) -> any()

  • Id = atom()

Return server’s items

put/3

put(Id, Key, Value) -> ok | {error, any()}

  • Id = atom()
  • Key = binary()
  • Value = binary()

Insert a key-value pair into the leo_dcerl

put/4

put(Id, Ref, Key, Value) -> ok | {error, any()}

  • Id = atom()
  • Ref = any()
  • Key = binary()
  • Value = binary()

put_begin_tran/2

put_begin_tran(Id, Key) -> ok | {error, any()}

  • Id = atom()
  • Key = binary()

Start transaction of insert chunked objects

put_end_tran/5

put_end_tran(Id, Ref, Key, Meta, IsCommit) -> ok | {error, any()}

  • Id = atom()
  • Ref = any()
  • Key = binary()
  • Meta = #cache_meta{}
  • IsCommit = boolean()

End transaction of insert chunked objects

size/1

size(Id) -> any()

  • Id = atom()

Return server’s summary of cache size

stats/1

stats(Id) -> any()

  • Id = atom()

Return server’s state

stop/1

stop(Pid) -> ok

  • Pid = atom()

Manually stops the server.

terminate/2

terminate(Reason, State) -> any()

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.