| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| <html> |
| <head> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <title>Caches: GLib Reference Manual</title> |
| <meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> |
| <link rel="home" href="index.html" title="GLib Reference Manual"> |
| <link rel="up" href="deprecated.html" title="Deprecated APIs"> |
| <link rel="prev" href="glib-Deprecated-Thread-APIs.html" title="Deprecated thread API"> |
| <link rel="next" href="glib-Relations-and-Tuples.html" title="Relations and Tuples"> |
| <meta name="generator" content="GTK-Doc V1.25.1 (XML mode)"> |
| <link rel="stylesheet" href="style.css" type="text/css"> |
| </head> |
| <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> |
| <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle"> |
| <td width="100%" align="left" class="shortcuts"> |
| <a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span> |
| <a href="#glib-Caches.description" class="shortcut">Description</a></span> |
| </td> |
| <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td> |
| <td><a accesskey="u" href="deprecated.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td> |
| <td><a accesskey="p" href="glib-Deprecated-Thread-APIs.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td> |
| <td><a accesskey="n" href="glib-Relations-and-Tuples.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td> |
| </tr></table> |
| <div class="refentry"> |
| <a name="glib-Caches"></a><div class="titlepage"></div> |
| <div class="refnamediv"><table width="100%"><tr> |
| <td valign="top"> |
| <h2><span class="refentrytitle"><a name="glib-Caches.top_of_page"></a>Caches</span></h2> |
| <p>Caches — caches allow sharing of complex data structures |
| to save resources</p> |
| </td> |
| <td class="gallery_image" valign="top" align="right"></td> |
| </tr></table></div> |
| <div class="refsect1"> |
| <a name="glib-Caches.functions"></a><h2>Functions</h2> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="functions_return"> |
| <col class="functions_name"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="function_type"> |
| <a class="link" href="glib-Caches.html#GCache" title="GCache"><span class="returnvalue">GCache</span></a> * |
| </td> |
| <td class="function_name"> |
| <a class="link" href="glib-Caches.html#g-cache-new" title="g_cache_new ()">g_cache_new</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="glib-Caches.html#g-cache-insert" title="g_cache_insert ()">g_cache_insert</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="glib-Caches.html#g-cache-remove" title="g_cache_remove ()">g_cache_remove</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="glib-Caches.html#g-cache-destroy" title="g_cache_destroy ()">g_cache_destroy</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="glib-Caches.html#g-cache-key-foreach" title="g_cache_key_foreach ()">g_cache_key_foreach</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <a class="link" href="glib-Caches.html#g-cache-value-foreach" title="g_cache_value_foreach ()">g_cache_value_foreach</a> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <span class="returnvalue">void</span> |
| </td> |
| <td class="function_name"> |
| <span class="c_punctuation">(</span><a class="link" href="glib-Caches.html#GCacheDestroyFunc" title="GCacheDestroyFunc ()">*GCacheDestroyFunc</a><span class="c_punctuation">)</span> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> |
| </td> |
| <td class="function_name"> |
| <span class="c_punctuation">(</span><a class="link" href="glib-Caches.html#GCacheDupFunc" title="GCacheDupFunc ()">*GCacheDupFunc</a><span class="c_punctuation">)</span> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| <tr> |
| <td class="function_type"> |
| <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> |
| </td> |
| <td class="function_name"> |
| <span class="c_punctuation">(</span><a class="link" href="glib-Caches.html#GCacheNewFunc" title="GCacheNewFunc ()">*GCacheNewFunc</a><span class="c_punctuation">)</span> <span class="c_punctuation">()</span> |
| </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect1"> |
| <a name="glib-Caches.other"></a><h2>Types and Values</h2> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="name"> |
| <col class="description"> |
| </colgroup> |
| <tbody><tr> |
| <td class="datatype_keyword"> </td> |
| <td class="function_name"><a class="link" href="glib-Caches.html#GCache" title="GCache">GCache</a></td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| <div class="refsect1"> |
| <a name="glib-Caches.includes"></a><h2>Includes</h2> |
| <pre class="synopsis">#include <glib.h> |
| </pre> |
| </div> |
| <div class="refsect1"> |
| <a name="glib-Caches.description"></a><h2>Description</h2> |
| <p>A <a class="link" href="glib-Caches.html#GCache" title="GCache"><span class="type">GCache</span></a> allows sharing of complex data structures, in order to |
| save system resources.</p> |
| <p>GCache uses keys and values. A GCache key describes the properties |
| of a particular resource. A GCache value is the actual resource.</p> |
| <p>GCache has been marked as deprecated, since this API is rarely |
| used and not very actively maintained.</p> |
| </div> |
| <div class="refsect1"> |
| <a name="glib-Caches.functions_details"></a><h2>Functions</h2> |
| <div class="refsect2"> |
| <a name="g-cache-new"></a><h3>g_cache_new ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Caches.html#GCache" title="GCache"><span class="returnvalue">GCache</span></a> * |
| g_cache_new (<em class="parameter"><code><a class="link" href="glib-Caches.html#GCacheNewFunc" title="GCacheNewFunc ()"><span class="type">GCacheNewFunc</span></a> value_new_func</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Caches.html#GCacheDestroyFunc" title="GCacheDestroyFunc ()"><span class="type">GCacheDestroyFunc</span></a> value_destroy_func</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Caches.html#GCacheDupFunc" title="GCacheDupFunc ()"><span class="type">GCacheDupFunc</span></a> key_dup_func</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Caches.html#GCacheDestroyFunc" title="GCacheDestroyFunc ()"><span class="type">GCacheDestroyFunc</span></a> key_destroy_func</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Hash-Tables.html#GHashFunc" title="GHashFunc ()"><span class="type">GHashFunc</span></a> hash_key_func</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Hash-Tables.html#GHashFunc" title="GHashFunc ()"><span class="type">GHashFunc</span></a> hash_value_func</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Hash-Tables.html#GEqualFunc" title="GEqualFunc ()"><span class="type">GEqualFunc</span></a> key_equal_func</code></em>);</pre> |
| <div class="warning"> |
| <p><code class="literal">g_cache_new</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p> |
| <p>Use a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a> instead</p> |
| </div> |
| <p>Creates a new <a class="link" href="glib-Caches.html#GCache" title="GCache"><span class="type">GCache</span></a>.</p> |
| <div class="refsect3"> |
| <a name="g-cache-new.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>value_new_func</p></td> |
| <td class="parameter_description"><p>a function to create a new object given a key. |
| This is called by <a class="link" href="glib-Caches.html#g-cache-insert" title="g_cache_insert ()"><code class="function">g_cache_insert()</code></a> if an object |
| with the given key does not already exist</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>value_destroy_func</p></td> |
| <td class="parameter_description"><p>a function to destroy an object. It is called |
| by <a class="link" href="glib-Caches.html#g-cache-remove" title="g_cache_remove ()"><code class="function">g_cache_remove()</code></a> when the object is no |
| longer needed (i.e. its reference count drops |
| to 0)</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>key_dup_func</p></td> |
| <td class="parameter_description"><p>a function to copy a key. It is called by |
| <a class="link" href="glib-Caches.html#g-cache-insert" title="g_cache_insert ()"><code class="function">g_cache_insert()</code></a> if the key does not already exist in |
| the <a class="link" href="glib-Caches.html#GCache" title="GCache"><span class="type">GCache</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>key_destroy_func</p></td> |
| <td class="parameter_description"><p>a function to destroy a key. It is called by |
| <a class="link" href="glib-Caches.html#g-cache-remove" title="g_cache_remove ()"><code class="function">g_cache_remove()</code></a> when the object is no longer |
| needed (i.e. its reference count drops to 0)</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>hash_key_func</p></td> |
| <td class="parameter_description"><p>a function to create a hash value from a key</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>hash_value_func</p></td> |
| <td class="parameter_description"><p>a function to create a hash value from a value</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>key_equal_func</p></td> |
| <td class="parameter_description"><p>a function to compare two keys. It should return |
| <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the two keys are equivalent</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-cache-new.returns"></a><h4>Returns</h4> |
| <p> a new <a class="link" href="glib-Caches.html#GCache" title="GCache"><span class="type">GCache</span></a></p> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-cache-insert"></a><h3>g_cache_insert ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> |
| g_cache_insert (<em class="parameter"><code><a class="link" href="glib-Caches.html#GCache" title="GCache"><span class="type">GCache</span></a> *cache</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> key</code></em>);</pre> |
| <div class="warning"> |
| <p><code class="literal">g_cache_insert</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p> |
| <p>Use a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a> instead</p> |
| </div> |
| <p>Gets the value corresponding to the given key, creating it if |
| necessary. It first checks if the value already exists in the |
| <a class="link" href="glib-Caches.html#GCache" title="GCache"><span class="type">GCache</span></a>, by using the <em class="parameter"><code>key_equal_func</code></em> |
| function passed to |
| <a class="link" href="glib-Caches.html#g-cache-new" title="g_cache_new ()"><code class="function">g_cache_new()</code></a>. If it does already exist it is returned, and its |
| reference count is increased by one. If the value does not currently |
| exist, if is created by calling the <em class="parameter"><code>value_new_func</code></em> |
| . The key is |
| duplicated by calling <em class="parameter"><code>key_dup_func</code></em> |
| and the duplicated key and value |
| are inserted into the <a class="link" href="glib-Caches.html#GCache" title="GCache"><span class="type">GCache</span></a>.</p> |
| <div class="refsect3"> |
| <a name="g-cache-insert.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>cache</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="glib-Caches.html#GCache" title="GCache"><span class="type">GCache</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>key</p></td> |
| <td class="parameter_description"><p>a key describing a <a class="link" href="glib-Caches.html#GCache" title="GCache"><span class="type">GCache</span></a> object</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="g-cache-insert.returns"></a><h4>Returns</h4> |
| <p> a pointer to a <a class="link" href="glib-Caches.html#GCache" title="GCache"><span class="type">GCache</span></a> value</p> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-cache-remove"></a><h3>g_cache_remove ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_cache_remove (<em class="parameter"><code><a class="link" href="glib-Caches.html#GCache" title="GCache"><span class="type">GCache</span></a> *cache</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="type">gconstpointer</span></a> value</code></em>);</pre> |
| <div class="warning"> |
| <p><code class="literal">g_cache_remove</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p> |
| <p>Use a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a> instead</p> |
| </div> |
| <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 class="link" href="glib-Caches.html#g-cache-new" title="g_cache_new ()"><code class="function">g_cache_new()</code></a>.</p> |
| <div class="refsect3"> |
| <a name="g-cache-remove.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>cache</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="glib-Caches.html#GCache" title="GCache"><span class="type">GCache</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>value</p></td> |
| <td class="parameter_description"><p>the value to remove</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-cache-destroy"></a><h3>g_cache_destroy ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_cache_destroy (<em class="parameter"><code><a class="link" href="glib-Caches.html#GCache" title="GCache"><span class="type">GCache</span></a> *cache</code></em>);</pre> |
| <div class="warning"> |
| <p><code class="literal">g_cache_destroy</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p> |
| <p>Use a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a> instead</p> |
| </div> |
| <p>Frees the memory allocated for the <a class="link" href="glib-Caches.html#GCache" title="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 class="link" href="glib-Caches.html#GCache" title="GCache"><span class="type">GCache</span></a>.</p> |
| <div class="refsect3"> |
| <a name="g-cache-destroy.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>cache</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="glib-Caches.html#GCache" title="GCache"><span class="type">GCache</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-cache-key-foreach"></a><h3>g_cache_key_foreach ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_cache_key_foreach (<em class="parameter"><code><a class="link" href="glib-Caches.html#GCache" title="GCache"><span class="type">GCache</span></a> *cache</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Hash-Tables.html#GHFunc" title="GHFunc ()"><span class="type">GHFunc</span></a> func</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre> |
| <div class="warning"> |
| <p><code class="literal">g_cache_key_foreach</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p> |
| <p>Use a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a> instead</p> |
| </div> |
| <p>Calls the given function for each of the keys in the <a class="link" href="glib-Caches.html#GCache" title="GCache"><span class="type">GCache</span></a>.</p> |
| <p>NOTE <em class="parameter"><code>func</code></em> |
| is passed three parameters, the value and key of a cache |
| entry and the <em class="parameter"><code>user_data</code></em> |
| . The order of value and key is different |
| from the order in which <a class="link" href="glib-Hash-Tables.html#g-hash-table-foreach" title="g_hash_table_foreach ()"><code class="function">g_hash_table_foreach()</code></a> passes key-value |
| pairs to its callback function !</p> |
| <div class="refsect3"> |
| <a name="g-cache-key-foreach.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>cache</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="glib-Caches.html#GCache" title="GCache"><span class="type">GCache</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>func</p></td> |
| <td class="parameter_description"><p>the function to call with each <a class="link" href="glib-Caches.html#GCache" title="GCache"><span class="type">GCache</span></a> key</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>user_data</p></td> |
| <td class="parameter_description"><p>user data to pass to the function</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="g-cache-value-foreach"></a><h3>g_cache_value_foreach ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| g_cache_value_foreach (<em class="parameter"><code><a class="link" href="glib-Caches.html#GCache" title="GCache"><span class="type">GCache</span></a> *cache</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Hash-Tables.html#GHFunc" title="GHFunc ()"><span class="type">GHFunc</span></a> func</code></em>, |
| <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre> |
| <div class="warning"> |
| <p><code class="literal">g_cache_value_foreach</code> has been deprecated since version 2.10 and should not be used in newly-written code.</p> |
| <p>The reason is that it passes pointers to internal |
| data structures to <em class="parameter"><code>func</code></em> |
| ; use <a class="link" href="glib-Caches.html#g-cache-key-foreach" title="g_cache_key_foreach ()"><code class="function">g_cache_key_foreach()</code></a> instead</p> |
| </div> |
| <p>Calls the given function for each of the values in the <a class="link" href="glib-Caches.html#GCache" title="GCache"><span class="type">GCache</span></a>.</p> |
| <div class="refsect3"> |
| <a name="g-cache-value-foreach.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody> |
| <tr> |
| <td class="parameter_name"><p>cache</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="glib-Caches.html#GCache" title="GCache"><span class="type">GCache</span></a></p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>func</p></td> |
| <td class="parameter_description"><p>the function to call with each <a class="link" href="glib-Caches.html#GCache" title="GCache"><span class="type">GCache</span></a> value</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| <tr> |
| <td class="parameter_name"><p>user_data</p></td> |
| <td class="parameter_description"><p>user data to pass to the function</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr> |
| </tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="GCacheDestroyFunc"></a><h3>GCacheDestroyFunc ()</h3> |
| <pre class="programlisting"><span class="returnvalue">void</span> |
| <span class="c_punctuation">(</span>*GCacheDestroyFunc<span class="c_punctuation">)</span> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> value</code></em>);</pre> |
| <div class="warning"><p><code class="literal">GCacheDestroyFunc</code> is deprecated and should not be used in newly-written code.</p></div> |
| <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> |
| |
| functions passed to <a class="link" href="glib-Caches.html#g-cache-new" title="g_cache_new ()"><code class="function">g_cache_new()</code></a>. The functions are passed a |
| pointer to the <a class="link" href="glib-Caches.html#GCache" title="GCache"><span class="type">GCache</span></a> key or <a class="link" href="glib-Caches.html#GCache" title="GCache"><span class="type">GCache</span></a> value and should free any |
| memory and other resources associated with it.</p> |
| <div class="refsect3"> |
| <a name="GCacheDestroyFunc.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>value</p></td> |
| <td class="parameter_description"><p>the <a class="link" href="glib-Caches.html#GCache" title="GCache"><span class="type">GCache</span></a> value to destroy</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="GCacheDupFunc"></a><h3>GCacheDupFunc ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> |
| <span class="c_punctuation">(</span>*GCacheDupFunc<span class="c_punctuation">)</span> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> value</code></em>);</pre> |
| <div class="warning"><p><code class="literal">GCacheDupFunc</code> is deprecated and should not be used in newly-written code.</p></div> |
| <p>Specifies the type of the <em class="parameter"><code>key_dup_func</code></em> |
| function passed to |
| <a class="link" href="glib-Caches.html#g-cache-new" title="g_cache_new ()"><code class="function">g_cache_new()</code></a>. The function is passed a key |
| (<emphasis>not</emphasis> a value as the prototype implies) and |
| should return a duplicate of the key.</p> |
| <div class="refsect3"> |
| <a name="GCacheDupFunc.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>value</p></td> |
| <td class="parameter_description"><p>the <a class="link" href="glib-Caches.html#GCache" title="GCache"><span class="type">GCache</span></a> key to destroy (<emphasis>not</emphasis> a |
| <a class="link" href="glib-Caches.html#GCache" title="GCache"><span class="type">GCache</span></a> value as it seems)</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="GCacheDupFunc.returns"></a><h4>Returns</h4> |
| <p> a copy of the <a class="link" href="glib-Caches.html#GCache" title="GCache"><span class="type">GCache</span></a> key</p> |
| </div> |
| </div> |
| <hr> |
| <div class="refsect2"> |
| <a name="GCacheNewFunc"></a><h3>GCacheNewFunc ()</h3> |
| <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a> |
| <span class="c_punctuation">(</span>*GCacheNewFunc<span class="c_punctuation">)</span> (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> key</code></em>);</pre> |
| <div class="warning"><p><code class="literal">GCacheNewFunc</code> is deprecated and should not be used in newly-written code.</p></div> |
| <p>Specifies the type of the <em class="parameter"><code>value_new_func</code></em> |
| function passed to |
| <a class="link" href="glib-Caches.html#g-cache-new" title="g_cache_new ()"><code class="function">g_cache_new()</code></a>. It is passed a <a class="link" href="glib-Caches.html#GCache" title="GCache"><span class="type">GCache</span></a> key and should create the |
| value corresponding to the key.</p> |
| <div class="refsect3"> |
| <a name="GCacheNewFunc.parameters"></a><h4>Parameters</h4> |
| <div class="informaltable"><table class="informaltable" width="100%" border="0"> |
| <colgroup> |
| <col width="150px" class="parameters_name"> |
| <col class="parameters_description"> |
| <col width="200px" class="parameters_annotations"> |
| </colgroup> |
| <tbody><tr> |
| <td class="parameter_name"><p>key</p></td> |
| <td class="parameter_description"><p>a <a class="link" href="glib-Caches.html#GCache" title="GCache"><span class="type">GCache</span></a> key</p></td> |
| <td class="parameter_annotations"> </td> |
| </tr></tbody> |
| </table></div> |
| </div> |
| <div class="refsect3"> |
| <a name="GCacheNewFunc.returns"></a><h4>Returns</h4> |
| <p> a new <a class="link" href="glib-Caches.html#GCache" title="GCache"><span class="type">GCache</span></a> value corresponding to the key.</p> |
| </div> |
| </div> |
| </div> |
| <div class="refsect1"> |
| <a name="glib-Caches.other_details"></a><h2>Types and Values</h2> |
| <div class="refsect2"> |
| <a name="GCache"></a><h3>GCache</h3> |
| <pre class="programlisting">typedef struct _GCache GCache;</pre> |
| <div class="warning"> |
| <p><code class="literal">GCache</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p> |
| <p>Use a <a class="link" href="glib-Hash-Tables.html#GHashTable" title="GHashTable"><span class="type">GHashTable</span></a> instead</p> |
| </div> |
| <p>The <a class="link" href="glib-Caches.html#GCache" title="GCache"><span class="type">GCache</span></a> struct is an opaque data structure containing |
| information about a <a class="link" href="glib-Caches.html#GCache" title="GCache"><span class="type">GCache</span></a>. It should only be accessed via the |
| following functions.</p> |
| </div> |
| </div> |
| </div> |
| <div class="footer"> |
| <hr>Generated by GTK-Doc V1.25.1</div> |
| </body> |
| </html> |