Module gen_cache

Generic caching server.

Copyright © 2009 Mr Buzz, Inc.

Behaviours: gen_server.

Authors: Jacob Perkins.

Description

Generic caching server.

Function Index

cache/3Equivalent to cache(Name, Term, Value, 300000).
cache/4Store Value in cache server, referenced by Term.
forget/2Remove the Value referenced by Term from the cache server.
recall/2Lookup the Value referenced by Term from the cache server.
recall_apply/4Looks up result in cache server.
recall_apply/5
start_link/1Equivalent to gen_server:start_link({local, Name}, gen_cache, Name, []).

Function Details

cache/3

cache(Name::atom(), Term::term(), Value::term()) -> Value::term()

Equivalent to cache(Name, Term, Value, 300000).

cache/4

cache(Name::atom(), Term::term(), Value::term(), Timeout::integer()) -> Value::term()

Store Value in cache server, referenced by Term. Value is stored as a compressed binary. Timeout is how long Value should remain in cache.

forget/2

forget(Name::atom(), Term::term()) -> ok

Remove the Value referenced by Term from the cache server.

recall/2

recall(Name::atom(), Term::term()) -> term()

Lookup the Value referenced by Term from the cache server.

recall_apply/4

recall_apply(Name::atom(), Module::atom(), Function::atom(), Args::list()) -> term()

Looks up result in cache server. If no result is found, calls apply. Use this function to simplify the recall-cache pattern.

recall_apply/5

recall_apply() -> term()

start_link/1

start_link(Name::atom()) -> {ok, pid()}

Equivalent to gen_server:start_link({local, Name}, gen_cache, Name, []).


Generated by EDoc, Jul 14 2009, 14:06:01.