init
This commit is contained in:
75
ljcom/htdocs/code/cache/html
vendored
Normal file
75
ljcom/htdocs/code/cache/html
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>LJ::Cache - LRU Cache</TITLE>
|
||||
<LINK REV="made" HREF="mailto:hackers@FreeBSD.org">
|
||||
</HEAD>
|
||||
|
||||
<BODY>
|
||||
|
||||
<!-- INDEX BEGIN -->
|
||||
|
||||
<UL>
|
||||
|
||||
<LI><A HREF="#NAME">NAME</A>
|
||||
<LI><A HREF="#SYNOPSIS">SYNOPSIS</A>
|
||||
<LI><A HREF="#DESCRIPTION">DESCRIPTION</A>
|
||||
<LI><A HREF="#AUTHOR">AUTHOR</A>
|
||||
<LI><A HREF="#SEE_ALSO">SEE ALSO</A>
|
||||
</UL>
|
||||
<!-- INDEX END -->
|
||||
|
||||
<HR>
|
||||
<P>
|
||||
<H1><A NAME="NAME">NAME</A></H1>
|
||||
<P>
|
||||
LJ::Cache - LRU Cache
|
||||
|
||||
<P>
|
||||
<HR>
|
||||
<H1><A NAME="SYNOPSIS">SYNOPSIS</A></H1>
|
||||
<P>
|
||||
<PRE> use LJ::Cache;
|
||||
my $cache = new LJ::Cache { 'maxsize' => 20 };
|
||||
my $value = $cache->get($key);
|
||||
unless (defined $value) {
|
||||
$val = "load some value";
|
||||
$cache->set($key, $value);
|
||||
}
|
||||
</PRE>
|
||||
<P>
|
||||
<HR>
|
||||
<H1><A NAME="DESCRIPTION">DESCRIPTION</A></H1>
|
||||
<P>
|
||||
This class implements an LRU dictionary cache. The two operations on it are
|
||||
<CODE>get()</CODE> and <CODE>set(),</CODE> both of which promote the key
|
||||
being referenced to the ``top'' of the cache, so it will stay alive
|
||||
longest.
|
||||
|
||||
<P>
|
||||
When the cache is full and and a new item needs to be added, the oldest one
|
||||
is thrown away.
|
||||
|
||||
<P>
|
||||
You should be able to regenerate the data at any time, if
|
||||
<CODE>get()</CODE> returns undef.
|
||||
|
||||
<P>
|
||||
This class is useful for caching information from a slower data source
|
||||
while also keeping a bound on memory usage.
|
||||
|
||||
<P>
|
||||
<HR>
|
||||
<H1><A NAME="AUTHOR">AUTHOR</A></H1>
|
||||
<P>
|
||||
Brad Fitzpatrick, <A
|
||||
HREF="mailto:bradfitz@bradfitz.com">bradfitz@bradfitz.com</A>
|
||||
|
||||
<P>
|
||||
<HR>
|
||||
<H1><A NAME="SEE_ALSO">SEE ALSO</A></H1>
|
||||
<P>
|
||||
<CODE>perl(1).</CODE>
|
||||
|
||||
</BODY>
|
||||
|
||||
</HTML>
|
||||
25
ljcom/htdocs/code/cache/index.bml
vendored
Normal file
25
ljcom/htdocs/code/cache/index.bml
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?page
|
||||
title=>LJ::Cache
|
||||
body<=
|
||||
|
||||
<a href="../"><B><< Code</b></a> |
|
||||
<b>Download:</b> <?dl code/cache/ dl?>
|
||||
|
||||
<?h1 License h1?>
|
||||
<?p
|
||||
LJ::Cache is licensed under the <a href="http://www.gnu.org/copyleft/library.txt">LGPL</a>, also available in the distribution.
|
||||
p?>
|
||||
|
||||
<?_code
|
||||
|
||||
my $doc = `perldoc -u LJ::Cache | pod2html`;
|
||||
$doc =~ s/<H1>(.+?)<\/H1>/<?h1 $1 h1?>/g;
|
||||
$doc =~ s/<H2>(.+?)<\/H2>/<?h2 $1 h2?>/g;
|
||||
$doc =~ s/<HR>/<?hr?>/g;
|
||||
return $doc;
|
||||
|
||||
_code?>
|
||||
|
||||
|
||||
<=body
|
||||
page?>
|
||||
Reference in New Issue
Block a user