📄 caches.sgml
字号:
<title><anchor id="g-cache-remove">g_cache_remove ()</title><programlisting>void g_cache_remove (<link linkend="GCache">GCache</link> *cache, <link linkend="gconstpointer">gconstpointer</link> value);</programlisting><para>Decreases the reference count of the given value.If it drops to 0 then the value and its corresponding key are destroyed,using the <parameter>value_destroy_func</parameter> and <parameter>key_destroy_func</parameter> passed to <link linkend="g-cache-new">g_cache_new</link>().</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>cache</parameter> :</entry><entry>a <link linkend="GCache">GCache</link>.</entry></row><row><entry align="right"><parameter>value</parameter> :</entry><entry>the value to remove.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-cache-destroy">g_cache_destroy ()</title><programlisting>void g_cache_destroy (<link linkend="GCache">GCache</link> *cache);</programlisting><para>Frees the memory allocated for the <link linkend="GCache">GCache</link>.</para><para>Note that it does not destroy the keys and values which were contained in the<link linkend="GCache">GCache</link>.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>cache</parameter> :</entry><entry>a <link linkend="GCache">GCache</link>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-cache-key-foreach">g_cache_key_foreach ()</title><programlisting>void g_cache_key_foreach (<link linkend="GCache">GCache</link> *cache, <link linkend="GHFunc">GHFunc</link> func, <link linkend="gpointer">gpointer</link> user_data);</programlisting><para>Calls the given function for each of the keys in the <link linkend="GCache">GCache</link>.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>cache</parameter> :</entry><entry>a <link linkend="GCache">GCache</link>.</entry></row><row><entry align="right"><parameter>func</parameter> :</entry><entry>the function to call with each <link linkend="GCache">GCache</link> key.</entry></row><row><entry align="right"><parameter>user_data</parameter> :</entry><entry>user data to pass to the function.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-cache-value-foreach">g_cache_value_foreach ()</title><programlisting>void g_cache_value_foreach (<link linkend="GCache">GCache</link> *cache, <link linkend="GHFunc">GHFunc</link> func, <link linkend="gpointer">gpointer</link> user_data);</programlisting><para>Calls the given function for each of the values in the <link linkend="GCache">GCache</link>.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>cache</parameter> :</entry><entry>a <link linkend="GCache">GCache</link>.</entry></row><row><entry align="right"><parameter>func</parameter> :</entry><entry>the function to call with each <link linkend="GCache">GCache</link> value.</entry></row><row><entry align="right"><parameter>user_data</parameter> :</entry><entry>user data to pass to the function.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="GCacheDestroyFunc">GCacheDestroyFunc ()</title><programlisting>void (*GCacheDestroyFunc) (<link linkend="gpointer">gpointer</link> value);</programlisting><para>Specifies the type of the <parameter>value_destroy_func</parameter> and <parameter>key_destroy_func</parameter> functionspassed to <link linkend="g-cache-new">g_cache_new</link>().The functions are passed a pointer to the <link linkend="GCache">GCache</link> key or <link linkend="GCache">GCache</link> value andshould free any memory and other resources associated with it.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>value</parameter> :</entry><entry>the <link linkend="GCache">GCache</link> value to destroy.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="GCacheDupFunc">GCacheDupFunc ()</title><programlisting><link linkend="gpointer">gpointer</link> (*GCacheDupFunc) (<link linkend="gpointer">gpointer</link> value);</programlisting><para>Specifies the type of the <parameter>key_dup_func</parameter> function passed to <link linkend="g-cache-new">g_cache_new</link>().The function is passed a key (<emphasis>not</emphasis> a value as the prototype implies) andshould return a duplicate of the key.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>value</parameter> :</entry><entry>the <link linkend="GCache">GCache</link> key to destroy (<emphasis>not</emphasis> a <link linkend="GCache">GCache</link> value as it seems).</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>a copy of the <link linkend="GCache">GCache</link> key.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="GCacheNewFunc">GCacheNewFunc ()</title><programlisting><link linkend="gpointer">gpointer</link> (*GCacheNewFunc) (<link linkend="gpointer">gpointer</link> key);</programlisting><para>Specifies the type of the <parameter>value_new_func</parameter> function passed to <link linkend="g-cache-new">g_cache_new</link>().It is passed a <link linkend="GCache">GCache</link> key and should create the value corresponding to thekey.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>key</parameter> :</entry><entry>a <link linkend="GCache">GCache</link> key.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>a new <link linkend="GCache">GCache</link> value corresponding to the key.</entry></row></tbody></tgroup></informaltable></refsect2></refsect1></refentry>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -