📄 cache.html
字号:
<TD><CODE><B><A HREF="../../../../org/jivesoftware/smack/util/Cache.html#getCacheMisses()">getCacheMisses</A></B>()</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/jivesoftware/smack/util/Cache.html#getMaxCacheSize()">getMaxCacheSize</A></B>()</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> long</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/jivesoftware/smack/util/Cache.html#getMaxLifetime()">getMaxLifetime</A></B>()</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/jivesoftware/smack/util/Cache.html#isEmpty()">isEmpty</A></B>()</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/util/Set.html" title="class or interface in java.util">Set</A><<A HREF="../../../../org/jivesoftware/smack/util/Cache.html" title="type parameter in Cache">K</A>></CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/jivesoftware/smack/util/Cache.html#keySet()">keySet</A></B>()</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../../org/jivesoftware/smack/util/Cache.html" title="type parameter in Cache">V</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/jivesoftware/smack/util/Cache.html#put(K, V)">put</A></B>(<A HREF="../../../../org/jivesoftware/smack/util/Cache.html" title="type parameter in Cache">K</A> key, <A HREF="../../../../org/jivesoftware/smack/util/Cache.html" title="type parameter in Cache">V</A> value)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/jivesoftware/smack/util/Cache.html#putAll(java.util.Map)">putAll</A></B>(<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/util/Map.html" title="class or interface in java.util">Map</A><? extends <A HREF="../../../../org/jivesoftware/smack/util/Cache.html" title="type parameter in Cache">K</A>,? extends <A HREF="../../../../org/jivesoftware/smack/util/Cache.html" title="type parameter in Cache">V</A>> map)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../../org/jivesoftware/smack/util/Cache.html" title="type parameter in Cache">V</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/jivesoftware/smack/util/Cache.html#remove(java.lang.Object)">remove</A></B>(<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> key)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../../org/jivesoftware/smack/util/Cache.html" title="type parameter in Cache">V</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/jivesoftware/smack/util/Cache.html#remove(java.lang.Object, boolean)">remove</A></B>(<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> key, boolean internal)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/jivesoftware/smack/util/Cache.html#setMaxCacheSize(int)">setMaxCacheSize</A></B>(int maxCacheSize)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/jivesoftware/smack/util/Cache.html#setMaxLifetime(long)">setMaxLifetime</A></B>(long maxLifetime)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/jivesoftware/smack/util/Cache.html#size()">size</A></B>()</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/util/Collection.html" title="class or interface in java.util">Collection</A><<A HREF="../../../../org/jivesoftware/smack/util/Cache.html" title="type parameter in Cache">V</A>></CODE></FONT></TD><TD><CODE><B><A HREF="../../../../org/jivesoftware/smack/util/Cache.html#values()">values</A></B>()</CODE><BR> </TD></TR></TABLE> <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A></B></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD></TR></TABLE> <A NAME="methods_inherited_from_class_java.util.Map"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TH ALIGN="left"><B>Methods inherited from interface java.util.<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/util/Map.html" title="class or interface in java.util">Map</A></B></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/util/Map.html#equals(java.lang.Object)" title="class or interface in java.util">equals</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/util/Map.html#hashCode()" title="class or interface in java.util">hashCode</A></CODE></TD></TR></TABLE> <P><!-- ============ FIELD DETAIL =========== --><A NAME="field_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"><B>Field Detail</B></FONT></TH></TR></TABLE><A NAME="map"><!-- --></A><H3>map</H3><PRE>protected <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/util/Map.html" title="class or interface in java.util">Map</A><<A HREF="../../../../org/jivesoftware/smack/util/Cache.html" title="type parameter in Cache">K</A>,org.jivesoftware.smack.util.Cache.CacheObject<<A HREF="../../../../org/jivesoftware/smack/util/Cache.html" title="type parameter in Cache">V</A>>> <B>map</B></PRE><DL><DD>The map the keys and values are stored in.<P><DL></DL></DL><HR><A NAME="lastAccessedList"><!-- --></A><H3>lastAccessedList</H3><PRE>protected org.jivesoftware.smack.util.Cache.LinkedList <B>lastAccessedList</B></PRE><DL><DD>Linked list to maintain order that cache objects are accessed in, most used to least used.<P><DL></DL></DL><HR><A NAME="ageList"><!-- --></A><H3>ageList</H3><PRE>protected org.jivesoftware.smack.util.Cache.LinkedList <B>ageList</B></PRE><DL><DD>Linked list to maintain time that cache objects were initially added to the cache, most recently added to oldest added.<P><DL></DL></DL><HR><A NAME="maxCacheSize"><!-- --></A><H3>maxCacheSize</H3><PRE>protected int <B>maxCacheSize</B></PRE><DL><DD>Maximum number of items the cache will hold.<P><DL></DL></DL><HR><A NAME="maxLifetime"><!-- --></A><H3>maxLifetime</H3><PRE>protected long <B>maxLifetime</B></PRE><DL><DD>Maximum length of time objects can exist in cache before expiring.<P><DL></DL></DL><HR><A NAME="cacheHits"><!-- --></A><H3>cacheHits</H3><PRE>protected long <B>cacheHits</B></PRE><DL><DD>Maintain the number of cache hits and misses. A cache hit occurs every time the get method is called and the cache contains the requested object. A cache miss represents the opposite occurence.<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><DL></DL></DL><HR><A NAME="cacheMisses"><!-- --></A><H3>cacheMisses</H3><PRE>protected long <B>cacheMisses</B></PRE><DL><DD>Maintain the number of cache hits and misses. A cache hit occurs every time the get method is called and the cache contains the requested object. A cache miss represents the opposite occurence.<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><DL></DL></DL><!-- ========= CONSTRUCTOR DETAIL ======== --><A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"><B>Constructor Detail</B></FONT></TH></TR></TABLE><A NAME="Cache(int, long)"><!-- --></A><H3>Cache</H3><PRE>public <B>Cache</B>(int maxSize, long maxLifetime)</PRE><DL><DD>Create a new cache and specify the maximum size of for the cache in bytes, and the maximum lifetime of objects.<P><DL><DT><B>Parameters:</B><DD><CODE>maxSize</CODE> - the maximum number of objects the cache will hold. -1 means the cache has no max size.<DD><CODE>maxLifetime</CODE> - the maximum amount of time (in ms) objects can exist in cache before being deleted. -1 means objects never expire.</DL></DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"><B>Method Detail</B></FONT></TH></TR></TABLE><A NAME="put(java.lang.Object,java.lang.Object)"><!-- --></A><A NAME="put(K, V)"><!-- --></A><H3>put</H3><PRE>public <A HREF="../../../../org/jivesoftware/smack/util/Cache.html" title="type parameter in Cache">V</A> <B>put</B>(<A HREF="../../../../org/jivesoftware/smack/util/Cache.html" title="type parameter in Cache">K</A> key, <A HREF="../../../../org/jivesoftware/smack/util/Cache.html" title="type parameter in Cache">V</A> value)</PRE><DL><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/util/Map.html#put(K, V)" title="class or interface in java.util">put</A></CODE> in interface <CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/util/Map.html" title="class or interface in java.util">Map</A><<A HREF="../../../../org/jivesoftware/smack/util/Cache.html" title="type parameter in Cache">K</A>,<A HREF="../../../../org/jivesoftware/smack/util/Cache.html" title="type parameter in Cache">V</A>></CODE></DL></DD><DD><DL></DL></DD></DL><HR><A NAME="get(java.lang.Object)"><!-- --></A><H3>get</H3><PRE>public <A HREF="../../../../org/jivesoftware/smack/util/Cache.html" title="type parameter in Cache">V</A> <B>get</B>(<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> key)</PRE><DL><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/util/Map.html#get(java.lang.Object)" title="class or interface in java.util">get</A></CODE> in interface <CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/util/Map.html" title="class or interface in java.util">Map</A><<A HREF="../../../../org/jivesoftware/smack/util/Cache.html" title="type parameter in Cache">K</A>,<A HREF="../../../../org/jivesoftware/smack/util/Cache.html" title="type parameter in Cache">V</A>></CODE></DL></DD><DD><DL></DL></DD></DL><HR><A NAME="remove(java.lang.Object)"><!-- --></A><H3>remove</H3><PRE>public <A HREF="../../../../org/jivesoftware/smack/util/Cache.html" title="type parameter in Cache">V</A> <B>remove</B>(<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> key)</PRE><DL><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/util/Map.html#remove(java.lang.Object)" title="class or interface in java.util">remove</A></CODE> in interface <CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/util/Map.html" title="class or interface in java.util">Map</A><<A HREF="../../../../org/jivesoftware/smack/util/Cache.html" title="type parameter in Cache">K</A>,<A HREF="../../../../org/jivesoftware/smack/util/Cache.html" title="type parameter in Cache">V</A>></CODE></DL></DD><DD><DL></DL></DD></DL><HR><A NAME="remove(java.lang.Object, boolean)"><!-- --></A><H3>remove</H3><PRE>public <A HREF="../../../../org/jivesoftware/smack/util/Cache.html" title="type parameter in Cache">V</A> <B>remove</B>(<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> key, boolean internal)</PRE><DL><DD><DL>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -