Commit be20df38 authored by benoît chesneau's avatar benoît chesneau

bump to 2.3.0

parent c1cea592
Pipeline #4708916 passed with stage
in 54 seconds
......@@ -4,7 +4,7 @@
Copyright (c) 2016 Benoît Chesneau.
__Version:__ 2.2.0.
__Version:__ 2.3.0.
## Erlang LRU
......
......@@ -4,7 +4,7 @@
Copyright (c) 2016 Benoît Chesneau.
__Version:__ 2.2.0.
__Version:__ 2.3.0.
## Erlang LRU
......
......@@ -24,6 +24,16 @@ cache() = <a href="#type-cache">cache()</a> | <a href="#type-name">name()</a>
### <a name="type-callback">callback()</a> ###
<pre><code>
callback() = function() | {function(), list()} | {module(), function(), list()}
</code></pre>
### <a name="type-lru_option">lru_option()</a> ###
......@@ -46,8 +56,8 @@ name() = {local, Name::atom()} | {global, GlobalName::term()} | {via, ViaName::t
## Function Index ##
<table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#add-3">add/3</a></td><td>adds a value to the cache.</td></tr><tr><td valign="top"><a href="#contains-2">contains/2</a></td><td>check if the key is in the cache.</td></tr><tr><td valign="top"><a href="#contains_or_add-3">contains_or_add/3</a></td><td> checks if a key is in the cache (without updating the recent-ness or
deleting it for being stale), if not, adds the value.</td></tr><tr><td valign="top"><a href="#count-1">count/1</a></td><td>get the number of items in the cache.</td></tr><tr><td valign="top"><a href="#get-2">get/2</a></td><td>lookup a key's value from the cache.</td></tr><tr><td valign="top"><a href="#get-3">get/3</a></td><td>lookup a key's value from the cache.</td></tr><tr><td valign="top"><a href="#info-1">info/1</a></td><td>get cache info.</td></tr><tr><td valign="top"><a href="#keys-1">keys/1</a></td><td>return all the keys from the cache.</td></tr><tr><td valign="top"><a href="#peek-2">peek/2</a></td><td>Returns the key value (or undefined if not found) without updating the
<table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#add-3">add/3</a></td><td>adds a value to the cache.</td></tr><tr><td valign="top"><a href="#add_with-3">add_with/3</a></td><td>like add but with a callback.</td></tr><tr><td valign="top"><a href="#contains-2">contains/2</a></td><td>check if the key is in the cache.</td></tr><tr><td valign="top"><a href="#contains_or_add-3">contains_or_add/3</a></td><td> checks if a key is in the cache (without updating the recent-ness or
deleting it for being stale), if not, adds the value.</td></tr><tr><td valign="top"><a href="#contains_or_add_with-3">contains_or_add_with/3</a></td><td>like contains_or_add but with a callback.</td></tr><tr><td valign="top"><a href="#count-1">count/1</a></td><td>get the number of items in the cache.</td></tr><tr><td valign="top"><a href="#get-2">get/2</a></td><td>lookup a key's value from the cache.</td></tr><tr><td valign="top"><a href="#get-3">get/3</a></td><td>lookup a key's value from the cache.</td></tr><tr><td valign="top"><a href="#info-1">info/1</a></td><td>get cache info.</td></tr><tr><td valign="top"><a href="#keys-1">keys/1</a></td><td>return all the keys from the cache.</td></tr><tr><td valign="top"><a href="#peek-2">peek/2</a></td><td>Returns the key value (or undefined if not found) without updating the
"recently used"-ness of the key.</td></tr><tr><td valign="top"><a href="#peek-3">peek/3</a></td><td>Returns the key value (or undefined if not found) without updating the
"recently used"-ness of the key.</td></tr><tr><td valign="top"><a href="#purge-1">purge/1</a></td><td>purge all items from the cache.</td></tr><tr><td valign="top"><a href="#remove-2">remove/2</a></td><td>remove a key from the cache.</td></tr><tr><td valign="top"><a href="#remove_oldest-1">remove_oldest/1</a></td><td>remove the oldest item from the cache.</td></tr><tr><td valign="top"><a href="#reset_count-2">reset_count/2</a></td><td>reset the number of items in the cache.</td></tr><tr><td valign="top"><a href="#resize-2">resize/2</a></td><td>resize the cache.</td></tr><tr><td valign="top"><a href="#set_count-2">set_count/2</a></td><td>set the number of items in the cache.</td></tr><tr><td valign="top"><a href="#set_size-2">set_size/2</a></td><td>change the size of the cache.</td></tr><tr><td valign="top"><a href="#size-1">size/1</a></td><td>get the size of items in the cache.</td></tr><tr><td valign="top"><a href="#start-1">start/1</a></td><td>creates an LRU of the given size
Options are:
......@@ -65,12 +75,23 @@ registered name.</td></tr><tr><td valign="top"><a href="#stop-1">stop/1</a></td>
### add/3 ###
<pre><code>
add(Cache::<a href="#type-cache">cache()</a>, Key::term(), Value::term() | function()) -&gt; true | false
add(Cache::<a href="#type-cache">cache()</a>, Key::term(), Value::term()) -&gt; true | false
</code></pre>
<br />
adds a value to the cache. Returns true if an eviction occured.
<a name="add_with-3"></a>
### add_with/3 ###
<pre><code>
add_with(Cache::<a href="#type-cache">cache()</a>, Key::term(), Callback::<a href="#type-callback">callback()</a>) -&gt; true | false
</code></pre>
<br />
like add but with a callback
<a name="contains-2"></a>
### contains/2 ###
......@@ -87,7 +108,7 @@ check if the key is in the cache
### contains_or_add/3 ###
<pre><code>
contains_or_add(Cache::<a href="#type-cache">cache()</a>, Key::term(), Value::term() | function()) -&gt; {Exists::boolean(), Evict::boolean()}
contains_or_add(Cache::<a href="#type-cache">cache()</a>, Key::term(), Value::term()) -&gt; {Exists::boolean(), Evict::boolean()}
</code></pre>
<br />
......@@ -95,6 +116,17 @@ checks if a key is in the cache (without updating the recent-ness or
deleting it for being stale), if not, adds the value. Returns whether found and whether an eviction
occurred.
<a name="contains_or_add_with-3"></a>
### contains_or_add_with/3 ###
<pre><code>
contains_or_add_with(Cache::<a href="#type-cache">cache()</a>, Key::term(), Callback::<a href="#type-callback">callback()</a>) -&gt; {Exists::boolean(), Evict::boolean()}
</code></pre>
<br />
like contains_or_add but with a callback
<a name="count-1"></a>
### count/1 ###
......
@copyright 2016 Benoît Chesneau.
@version 2.2.0.
@version 2.3.0.
@title: Erlang LRU: a fixed size LRU cache.
@doc
......
{application, 'lru',
[{description, "implements a fixed-size LRU cache"},
{vsn, "2.2.0"},
{vsn, "2.3.0"},
{registered, []},
{applications,
[kernel,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment