📄 defaultcache.html
字号:
<A NAME="setName(java.lang.String)"><!-- --></A><H3>setName</H3><PRE>public void <B>setName</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> name)</PRE><DL><DD>Sets the name of this cache.<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../../../org/jivesoftware/util/cache/Cache.html#setName(java.lang.String)">setName</A></CODE> in interface <CODE><A HREF="../../../../org/jivesoftware/util/cache/Cache.html" title="interface in org.jivesoftware.util.cache">Cache</A><<A HREF="../../../../org/jivesoftware/util/cache/DefaultCache.html" title="type parameter in DefaultCache">K</A>,<A HREF="../../../../org/jivesoftware/util/cache/DefaultCache.html" title="type parameter in DefaultCache">V</A>></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - the name of this cache.</DL></DD></DL><HR><A NAME="getCacheHits()"><!-- --></A><H3>getCacheHits</H3><PRE>public long <B>getCacheHits</B>()</PRE><DL><DD>Returns the number of cache hits. A cache hit occurs every time the get method is called and the cache contains the requested object.<p> Keeping track of cache hits and misses lets one measure how efficient the cache is; the higher the percentage of hits, the more efficient.<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../../../org/jivesoftware/util/cache/Cache.html#getCacheHits()">getCacheHits</A></CODE> in interface <CODE><A HREF="../../../../org/jivesoftware/util/cache/Cache.html" title="interface in org.jivesoftware.util.cache">Cache</A><<A HREF="../../../../org/jivesoftware/util/cache/DefaultCache.html" title="type parameter in DefaultCache">K</A>,<A HREF="../../../../org/jivesoftware/util/cache/DefaultCache.html" title="type parameter in DefaultCache">V</A>></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>the number of cache hits.</DL></DD></DL><HR><A NAME="getCacheMisses()"><!-- --></A><H3>getCacheMisses</H3><PRE>public long <B>getCacheMisses</B>()</PRE><DL><DD>Returns the number of cache misses. A cache miss occurs every time the get method is called and the cache does not contain the requested object.<p> Keeping track of cache hits and misses lets one measure how efficient the cache is; the higher the percentage of hits, the more efficient.<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../../../org/jivesoftware/util/cache/Cache.html#getCacheMisses()">getCacheMisses</A></CODE> in interface <CODE><A HREF="../../../../org/jivesoftware/util/cache/Cache.html" title="interface in org.jivesoftware.util.cache">Cache</A><<A HREF="../../../../org/jivesoftware/util/cache/DefaultCache.html" title="type parameter in DefaultCache">K</A>,<A HREF="../../../../org/jivesoftware/util/cache/DefaultCache.html" title="type parameter in DefaultCache">V</A>></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>the number of cache hits.</DL></DD></DL><HR><A NAME="getCacheSize()"><!-- --></A><H3>getCacheSize</H3><PRE>public int <B>getCacheSize</B>()</PRE><DL><DD>Returns the size of the cache contents in bytes. This value is only a rough approximation, so cache users should expect that actual VM memory used by the cache could be significantly higher than the value reported by this method.<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../../../org/jivesoftware/util/cache/Cache.html#getCacheSize()">getCacheSize</A></CODE> in interface <CODE><A HREF="../../../../org/jivesoftware/util/cache/Cache.html" title="interface in org.jivesoftware.util.cache">Cache</A><<A HREF="../../../../org/jivesoftware/util/cache/DefaultCache.html" title="type parameter in DefaultCache">K</A>,<A HREF="../../../../org/jivesoftware/util/cache/DefaultCache.html" title="type parameter in DefaultCache">V</A>></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>the size of the cache contents in bytes.</DL></DD></DL><HR><A NAME="getMaxCacheSize()"><!-- --></A><H3>getMaxCacheSize</H3><PRE>public long <B>getMaxCacheSize</B>()</PRE><DL><DD>Returns the maximum size of the cache (in bytes). If the cache grows larger than the max size, the least frequently used items will be removed. If the max cache size is set to -1, there is no size limit.<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../../../org/jivesoftware/util/cache/Cache.html#getMaxCacheSize()">getMaxCacheSize</A></CODE> in interface <CODE><A HREF="../../../../org/jivesoftware/util/cache/Cache.html" title="interface in org.jivesoftware.util.cache">Cache</A><<A HREF="../../../../org/jivesoftware/util/cache/DefaultCache.html" title="type parameter in DefaultCache">K</A>,<A HREF="../../../../org/jivesoftware/util/cache/DefaultCache.html" title="type parameter in DefaultCache">V</A>></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>the maximum size of the cache (-1 indicates unlimited max size).</DL></DD></DL><HR><A NAME="setMaxCacheSize(int)"><!-- --></A><H3>setMaxCacheSize</H3><PRE>public void <B>setMaxCacheSize</B>(int maxCacheSize)</PRE><DL><DD>Sets the maximum size of the cache. If the cache grows larger than the max size, the least frequently used items will be removed. If the max cache size is set to -1, there is no size limit.<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../../../org/jivesoftware/util/cache/Cache.html#setMaxCacheSize(int)">setMaxCacheSize</A></CODE> in interface <CODE><A HREF="../../../../org/jivesoftware/util/cache/Cache.html" title="interface in org.jivesoftware.util.cache">Cache</A><<A HREF="../../../../org/jivesoftware/util/cache/DefaultCache.html" title="type parameter in DefaultCache">K</A>,<A HREF="../../../../org/jivesoftware/util/cache/DefaultCache.html" title="type parameter in DefaultCache">V</A>></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>maxCacheSize</CODE> - the maximum size of this cache (-1 indicates unlimited max size).</DL></DD></DL><HR><A NAME="getMaxLifetime()"><!-- --></A><H3>getMaxLifetime</H3><PRE>public long <B>getMaxLifetime</B>()</PRE><DL><DD>Returns the maximum number of milleseconds that any object can live in cache. Once the specified number of milleseconds passes, the object will be automatically expried from cache. If the max lifetime is set to -1, then objects never expire.<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../../../org/jivesoftware/util/cache/Cache.html#getMaxLifetime()">getMaxLifetime</A></CODE> in interface <CODE><A HREF="../../../../org/jivesoftware/util/cache/Cache.html" title="interface in org.jivesoftware.util.cache">Cache</A><<A HREF="../../../../org/jivesoftware/util/cache/DefaultCache.html" title="type parameter in DefaultCache">K</A>,<A HREF="../../../../org/jivesoftware/util/cache/DefaultCache.html" title="type parameter in DefaultCache">V</A>></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>the maximum number of milleseconds before objects are expired.</DL></DD></DL><HR><A NAME="setMaxLifetime(long)"><!-- --></A><H3>setMaxLifetime</H3><PRE>public void <B>setMaxLifetime</B>(long maxLifetime)</PRE><DL><DD>Sets the maximum number of milleseconds that any object can live in cache. Once the specified number of milleseconds passes, the object will be automatically expried from cache. If the max lifetime is set to -1, then objects never expire.<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../../../org/jivesoftware/util/cache/Cache.html#setMaxLifetime(long)">setMaxLifetime</A></CODE> in interface <CODE><A HREF="../../../../org/jivesoftware/util/cache/Cache.html" title="interface in org.jivesoftware.util.cache">Cache</A><<A HREF="../../../../org/jivesoftware/util/cache/DefaultCache.html" title="type parameter in DefaultCache">K</A>,<A HREF="../../../../org/jivesoftware/util/cache/DefaultCache.html" title="type parameter in DefaultCache">V</A>></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>maxLifetime</CODE> - the maximum number of milleseconds before objects are expired.</DL></DD></DL><HR><A NAME="deleteExpiredEntries()"><!-- --></A><H3>deleteExpiredEntries</H3><PRE>protected void <B>deleteExpiredEntries</B>()</PRE><DL><DD>Clears all entries out of cache where the entries are older than the maximum defined age.<P><DD><DL></DL></DD><DD><DL></DL></DD></DL><HR><A NAME="cullCache()"><!-- --></A><H3>cullCache</H3><PRE>protected final void <B>cullCache</B>()</PRE><DL><DD>Removes objects from cache if the cache is too full. "Too full" is defined as within 3% of the maximum cache size. Whenever the cache is is too big, the least frequently used elements are deleted until the cache is at least 10% empty.<P><DD><DL></DL></DD><DD><DL></DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ======= START OF BOTTOM NAVBAR ====== --><A NAME="navbar_bottom"><!-- --></A><A HREF="#skip-navbar_bottom" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Openfire 3.6.0a Javadoc</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../org/jivesoftware/util/cache/ClusterTask.html" title="interface in org.jivesoftware.util.cache"><B>PREV CLASS</B></A> <A HREF="../../../../org/jivesoftware/util/cache/DefaultLocalCacheStrategy.html" title="class in org.jivesoftware.util.cache"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html?org/jivesoftware/util/cache/DefaultCache.html" target="_top"><B>FRAMES</B></A> <A HREF="DefaultCache.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--></SCRIPT><NOSCRIPT> <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_bottom"></A><!-- ======== END OF BOTTOM NAVBAR ======= --><HR><i>Copyright © 2003-2008 Jive Software.</i></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -