📄 glib-caches.html
字号:
</tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3203594"></a><h3><a name="g-cache-remove"></a>g_cache_remove ()</h3><a class="indexterm" name="id3203605"></a><pre class="programlisting">void g_cache_remove (<a href="glib-Caches.html#GCache">GCache</a> *cache, <a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> value);</pre><p>Decreases the reference count of the given value.If it drops to 0 then the value and its corresponding key are destroyed,using the <em class="parameter"><code>value_destroy_func</code></em> and <em class="parameter"><code>key_destroy_func</code></em> passed to <a href="glib-Caches.html#g-cache-new"><code class="function">g_cache_new()</code></a>.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>cache</code></em> :</span></td><td>a <a href="glib-Caches.html#GCache"><span class="type">GCache</span></a>.</td></tr><tr><td><span class="term"><em class="parameter"><code>value</code></em> :</span></td><td>the value to remove.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3203705"></a><h3><a name="g-cache-destroy"></a>g_cache_destroy ()</h3><a class="indexterm" name="id3203716"></a><pre class="programlisting">void g_cache_destroy (<a href="glib-Caches.html#GCache">GCache</a> *cache);</pre><p>Frees the memory allocated for the <a href="glib-Caches.html#GCache"><span class="type">GCache</span></a>.</p><p>Note that it does not destroy the keys and values which were contained in the<a href="glib-Caches.html#GCache"><span class="type">GCache</span></a>.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>cache</code></em> :</span></td><td>a <a href="glib-Caches.html#GCache"><span class="type">GCache</span></a>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3203791"></a><h3><a name="g-cache-key-foreach"></a>g_cache_key_foreach ()</h3><a class="indexterm" name="id3203802"></a><pre class="programlisting">void g_cache_key_foreach (<a href="glib-Caches.html#GCache">GCache</a> *cache, <a href="glib-Hash-Tables.html#GHFunc">GHFunc</a> func, <a href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);</pre><p>Calls the given function for each of the keys in the <a href="glib-Caches.html#GCache"><span class="type">GCache</span></a>.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>cache</code></em> :</span></td><td>a <a href="glib-Caches.html#GCache"><span class="type">GCache</span></a>.</td></tr><tr><td><span class="term"><em class="parameter"><code>func</code></em> :</span></td><td>the function to call with each <a href="glib-Caches.html#GCache"><span class="type">GCache</span></a> key.</td></tr><tr><td><span class="term"><em class="parameter"><code>user_data</code></em> :</span></td><td>user data to pass to the function.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3203916"></a><h3><a name="g-cache-value-foreach"></a>g_cache_value_foreach ()</h3><a class="indexterm" name="id3203927"></a><pre class="programlisting">void g_cache_value_foreach (<a href="glib-Caches.html#GCache">GCache</a> *cache, <a href="glib-Hash-Tables.html#GHFunc">GHFunc</a> func, <a href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);</pre><p>Calls the given function for each of the values in the <a href="glib-Caches.html#GCache"><span class="type">GCache</span></a>.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>cache</code></em> :</span></td><td>a <a href="glib-Caches.html#GCache"><span class="type">GCache</span></a>.</td></tr><tr><td><span class="term"><em class="parameter"><code>func</code></em> :</span></td><td>the function to call with each <a href="glib-Caches.html#GCache"><span class="type">GCache</span></a> value.</td></tr><tr><td><span class="term"><em class="parameter"><code>user_data</code></em> :</span></td><td>user data to pass to the function.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3204041"></a><h3><a name="GCacheDestroyFunc"></a>GCacheDestroyFunc ()</h3><a class="indexterm" name="id3204052"></a><pre class="programlisting">void (*GCacheDestroyFunc) (<a href="glib-Basic-Types.html#gpointer">gpointer</a> value);</pre><p>Specifies the type of the <em class="parameter"><code>value_destroy_func</code></em> and <em class="parameter"><code>key_destroy_func</code></em> functionspassed to <a href="glib-Caches.html#g-cache-new"><code class="function">g_cache_new()</code></a>.The functions are passed a pointer to the <a href="glib-Caches.html#GCache"><span class="type">GCache</span></a> key or <a href="glib-Caches.html#GCache"><span class="type">GCache</span></a> value andshould free any memory and other resources associated with it.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>value</code></em> :</span></td><td>the <a href="glib-Caches.html#GCache"><span class="type">GCache</span></a> value to destroy.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3204147"></a><h3><a name="GCacheDupFunc"></a>GCacheDupFunc ()</h3><a class="indexterm" name="id3204157"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gpointer">gpointer</a> (*GCacheDupFunc) (<a href="glib-Basic-Types.html#gpointer">gpointer</a> value);</pre><p>Specifies the type of the <em class="parameter"><code>key_dup_func</code></em> function passed to <a href="glib-Caches.html#g-cache-new"><code class="function">g_cache_new()</code></a>.The function is passed a key (<span class="emphasis"><em>not</em></span> a value as the prototype implies) andshould return a duplicate of the key.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>value</code></em> :</span></td><td>the <a href="glib-Caches.html#GCache"><span class="type">GCache</span></a> key to destroy (<span class="emphasis"><em>not</em></span> a <a href="glib-Caches.html#GCache"><span class="type">GCache</span></a> value as it seems).</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>a copy of the <a href="glib-Caches.html#GCache"><span class="type">GCache</span></a> key.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3204264"></a><h3><a name="GCacheNewFunc"></a>GCacheNewFunc ()</h3><a class="indexterm" name="id3204274"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gpointer">gpointer</a> (*GCacheNewFunc) (<a href="glib-Basic-Types.html#gpointer">gpointer</a> key);</pre><p>Specifies the type of the <em class="parameter"><code>value_new_func</code></em> function passed to <a href="glib-Caches.html#g-cache-new"><code class="function">g_cache_new()</code></a>.It is passed a <a href="glib-Caches.html#GCache"><span class="type">GCache</span></a> key and should create the value corresponding to thekey.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>key</code></em> :</span></td><td>a <a href="glib-Caches.html#GCache"><span class="type">GCache</span></a> key.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>a new <a href="glib-Caches.html#GCache"><span class="type">GCache</span></a> value corresponding to the key.</td></tr></tbody></table></div></div></div></div><table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"><td align="left"><a accesskey="p" href="glib-Relations-and-Tuples.html"><b><< Relations and Tuples</b></a></td><td align="right"><a accesskey="n" href="glib-Memory-Allocators.html"><b>Memory Allocators >></b></a></td></tr></table></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -