leo_cache_api

The cache API.

References

Description

The cache API

Function Index

delete/1 Remove an object from the momory storage.
get/1 Retrieve an object from the momory storage.
get/2 Retrieve a chunked-object from disc-cache (for large-object).
get_filepath/1 Retrieve a meta data of cached object (for large-object).
get_ref/1 Retrieve a reference of cached object (for large-object).
put/2 Insert an object into the momory storage.
put/3 Insert a chunked-object into the disc.
put_begin_tran/1 Insert a chunked-object into the disc.
put_end_tran/4 Insert a chunked-object into the disc.
start/0 Launch cache-server(s).
start/1  
stats/0 Retrieve status of this application.
stop/0 Stop cache-server(s).

Function Details

delete/1

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

  • Key = binary()

Remove an object from the momory storage

get/1

get(Key) -> not_found | {ok, binary()} | {error, any()}

  • Key = binary()

Retrieve an object from the momory storage

get/2

get(Ref, Key) -> not_found | {ok, {binary(), boolean()}} | {error, any()}

  • Ref = reference()
  • Key = binary()

Retrieve a chunked-object from disc-cache (for large-object)

get_filepath/1

get_filepath(Key) -> not_found | {ok, #cache_meta{}} | {error, any()}

  • Key = binary()

Retrieve a meta data of cached object (for large-object)

get_ref/1

get_ref(Key) -> not_found | {ok, reference()} | {error, any()}

  • Key = binary()

Retrieve a reference of cached object (for large-object)

put/2

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

  • Key = binary()
  • Value = binary()

Insert an object into the momory storage

put/3

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

  • Ref = reference()
  • Key = binary()
  • Value = binary()

Insert a chunked-object into the disc

put_begin_tran/1

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

  • Key = binary()

Insert a chunked-object into the disc

put_end_tran/4

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

  • Ref = reference()
  • Key = binary()
  • Meta = #cache_meta{}
  • IsCommit = boolean()

Insert a chunked-object into the disc

start/0

start() -> ok | {error, any()}

Launch cache-server(s)

start/1

start(Options) -> ok | {error, any()}

  • Options = [{atom(), any()}]

stats/0

stats() -> {ok, any()}

Retrieve status of this application

stop/0

stop() -> ok

Stop cache-server(s)