glib-Caches.html   [plain text]


<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Caches</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="GLib Reference Manual"><link rel="up" href="glib-data-types.html" title="GLib Data Types"><link rel="previous" href="glib-Relations-and-Tuples.html" title="Relations and Tuples"><link rel="next" href="glib-Memory-Allocators.html" title="Memory Allocators"><link rel="chapter" href="glib.html" title="GLib Overview"><link rel="refentry" href="glib-building.html" title="Compiling the GLib package"><link rel="refentry" href="glib-cross-compiling.html" title="Cross-compiling the GLib package"><link rel="refentry" href="glib-compiling.html" title="Compiling GLib Applications"><link rel="refentry" href="glib-running.html" title="Running GLib Applications"><link rel="refentry" href="glib-changes.html" title="Changes to GLib"><link rel="refentry" href="glib-resources.html" title="Mailing lists and bug reports"><link rel="chapter" href="glib-fundamentals.html" title="GLib Fundamentals"><link rel="refentry" href="glib-Basic-Types.html" title="Basic Types"><link rel="refentry" href="glib-Limits-of-Basic-Types.html" title="Limits of Basic Types"><link rel="refentry" href="glib-Standard-Macros.html" title="Standard Macros"><link rel="refentry" href="glib-Type-Conversion-Macros.html" title="Type Conversion Macros"><link rel="refentry" href="glib-Byte-Order-Macros.html" title="Byte Order Macros"><link rel="refentry" href="glib-Numerical-Definitions.html" title="Numerical Definitions"><link rel="refentry" href="glib-Miscellaneous-Macros.html" title="Miscellaneous Macros"><link rel="refentry" href="glib-Atomic-Operations.html" title="Atomic Operations"><link rel="chapter" href="glib-core.html" title="GLib Core Application Support"><link rel="refentry" href="glib-The-Main-Event-Loop.html" title="The Main Event Loop"><link rel="refentry" href="glib-Threads.html" title="
Threads"><link rel="refentry" href="glib-Thread-Pools.html" title="Thread Pools"><link rel="refentry" href="glib-Asynchronous-Queues.html" title="Asynchronous Queues"><link rel="refentry" href="glib-Dynamic-Loading-of-Modules.html" title="Dynamic Loading of Modules"><link rel="refentry" href="glib-Memory-Allocation.html" title="Memory Allocation"><link rel="refentry" href="glib-IO-Channels.html" title="IO Channels"><link rel="refentry" href="glib-Error-Reporting.html" title="Error Reporting"><link rel="refentry" href="glib-Warnings-and-Assertions.html" title="Message Output and Debugging Functions"><link rel="refentry" href="glib-Message-Logging.html" title="Message Logging"><link rel="chapter" href="glib-utilities.html" title="GLib Utilities"><link rel="refentry" href="glib-String-Utility-Functions.html" title="String Utility Functions"><link rel="refentry" href="glib-Character-Set-Conversion.html" title="Character Set Conversion"><link rel="refentry" href="glib-Unicode-Manipulation.html" title="Unicode Manipulation"><link rel="refentry" href="glib-I18N.html" title="Internationalization"><link rel="refentry" href="glib-Date-and-Time-Functions.html" title="Date and Time Functions"><link rel="refentry" href="glib-Random-Numbers.html" title="Random Numbers"><link rel="refentry" href="glib-Hook-Functions.html" title="Hook Functions"><link rel="refentry" href="glib-Miscellaneous-Utility-Functions.html" title="Miscellaneous Utility Functions"><link rel="refentry" href="glib-Lexical-Scanner.html" title="Lexical Scanner"><link rel="refentry" href="glib-Automatic-String-Completion.html" title="Automatic String Completion"><link rel="refentry" href="glib-Timers.html" title="Timers"><link rel="refentry" href="glib-Spawning-Processes.html" title="Spawning Processes"><link rel="refentry" href="glib-File-Utilities.html" title="File Utilities"><link rel="refentry" href="glib-Shell-related-Utilities.html" title="Shell-related Utilities"><link rel="refentry" href="glib-Glob-style-pattern-matching.html" title="Glob-style pattern matching"><link rel="refentry" href="glib-Simple-XML-Subset-Parser.html" title="Simple XML Subset Parser"><link rel="refentry" href="glib-Windows-Compatability-Functions.html" title="Windows Compatibility Functions"><link rel="chapter" href="glib-data-types.html" title="GLib Data Types"><link rel="refentry" href="glib-Memory-Chunks.html" title="Memory Chunks"><link rel="refentry" href="glib-Doubly-Linked-Lists.html" title="Doubly-Linked Lists"><link rel="refentry" href="glib-Singly-Linked-Lists.html" title="Singly-Linked Lists"><link rel="refentry" href="glib-Double-ended-Queues.html" title="Double-ended Queues"><link rel="refentry" href="glib-Trash-Stacks.html" title="Trash Stacks"><link rel="refentry" href="glib-Hash-Tables.html" title="Hash Tables"><link rel="refentry" href="glib-Strings.html" title="Strings"><link rel="refentry" href="glib-String-Chunks.html" title="String Chunks"><link rel="refentry" href="glib-Arrays.html" title="Arrays"><link rel="refentry" href="glib-Pointer-Arrays.html" title="Pointer Arrays"><link rel="refentry" href="glib-Byte-Arrays.html" title="Byte Arrays"><link rel="refentry" href="glib-Balanced-Binary-Trees.html" title="Balanced Binary Trees"><link rel="refentry" href="glib-N-ary-Trees.html" title="N-ary Trees"><link rel="refentry" href="glib-Quarks.html" title="Quarks"><link rel="refentry" href="glib-Keyed-Data-Lists.html" title="Keyed Data Lists"><link rel="refentry" href="glib-Datasets.html" title="Datasets"><link rel="refentry" href="glib-Relations-and-Tuples.html" title="Relations and Tuples"><link rel="refentry" href="glib-Caches.html" title="Caches"><link rel="refentry" href="glib-Memory-Allocators.html" title="Memory Allocators"><link rel="chapter" href="tools.html" title="GLib Tools"><link rel="refentry" href="glib-gettextize.html" title="glib-gettextize"><link rel="index" href="ix01.html" title="Index"><link rel="section" href="glib-Caches.html#id3338110" title="Description"><link rel="section" href="glib-Caches.html#id3338209" title="Details"><meta name="generator" content="GTK-Doc V1.2 (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" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="glib-Relations-and-Tuples.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="glib-data-types.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">GLib Reference Manual</th><td><a accesskey="n" href="glib-Memory-Allocators.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr></table><div class="refentry" lang="en"><a name="glib-Caches"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2><span class="refentrytitle">Caches</span></h2><p>Caches &#8212; caches allow sharing of complex data structures to save resources.</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">

#include &lt;glib.h&gt;


struct      <a href="glib-Caches.html#GCache">GCache</a>;
<a href="glib-Caches.html#GCache">GCache</a>*     <a href="glib-Caches.html#g-cache-new">g_cache_new</a>                     (<a href="glib-Caches.html#GCacheNewFunc">GCacheNewFunc</a> value_new_func,
                                             <a href="glib-Caches.html#GCacheDestroyFunc">GCacheDestroyFunc</a> value_destroy_func,
                                             <a href="glib-Caches.html#GCacheDupFunc">GCacheDupFunc</a> key_dup_func,
                                             <a href="glib-Caches.html#GCacheDestroyFunc">GCacheDestroyFunc</a> key_destroy_func,
                                             <a href="glib-Hash-Tables.html#GHashFunc">GHashFunc</a> hash_key_func,
                                             <a href="glib-Hash-Tables.html#GHashFunc">GHashFunc</a> hash_value_func,
                                             <a href="glib-Hash-Tables.html#GEqualFunc">GEqualFunc</a> key_equal_func);
<a href="glib-Basic-Types.html#gpointer">gpointer</a>    <a href="glib-Caches.html#g-cache-insert">g_cache_insert</a>                  (<a href="glib-Caches.html#GCache">GCache</a> *cache,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> key);
void        <a href="glib-Caches.html#g-cache-remove">g_cache_remove</a>                  (<a href="glib-Caches.html#GCache">GCache</a> *cache,
                                             <a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> value);
void        <a href="glib-Caches.html#g-cache-destroy">g_cache_destroy</a>                 (<a href="glib-Caches.html#GCache">GCache</a> *cache);

void        <a href="glib-Caches.html#g-cache-key-foreach">g_cache_key_foreach</a>             (<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);
void        <a href="glib-Caches.html#g-cache-value-foreach">g_cache_value_foreach</a>           (<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);

void        (<a href="glib-Caches.html#GCacheDestroyFunc">*GCacheDestroyFunc</a>)            (<a href="glib-Basic-Types.html#gpointer">gpointer</a> value);
<a href="glib-Basic-Types.html#gpointer">gpointer</a>    (<a href="glib-Caches.html#GCacheDupFunc">*GCacheDupFunc</a>)                (<a href="glib-Basic-Types.html#gpointer">gpointer</a> value);
<a href="glib-Basic-Types.html#gpointer">gpointer</a>    (<a href="glib-Caches.html#GCacheNewFunc">*GCacheNewFunc</a>)                (<a href="glib-Basic-Types.html#gpointer">gpointer</a> key);
</pre></div><div class="refsect1" lang="en"><a name="id3338110"></a><h2>Description</h2><p>
A <a href="glib-Caches.html#GCache"><span class="type">GCache</span></a> allows sharing of complex data structures, in order to save
system resources.
</p><p>
GTK+ uses caches for <span class="type">GtkStyles</span> and <span class="type">GdkGCs</span>. These consume a lot of
resources, so a <a href="glib-Caches.html#GCache"><span class="type">GCache</span></a> is used to see if a <a
href="../gtk/GtkStyle.html"
><span class="type">GtkStyle</span></a> or <a
href="../gdk/gdk-Graphics-Contexts.html#GdkGC"
><span class="type">GdkGC</span></a> with the
required properties already exists. If it does, then the existing
object is used instead of creating a new one.
</p><p>
<a href="glib-Caches.html#GCache"><span class="type">GCache</span></a> uses keys and values.
A <a href="glib-Caches.html#GCache"><span class="type">GCache</span></a> key describes the properties of a particular resource.
A <a href="glib-Caches.html#GCache"><span class="type">GCache</span></a> value is the actual resource.
</p></div><div class="refsect1" lang="en"><a name="id3338209"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id3338215"></a><h3><a name="GCache"></a>struct GCache</h3><a class="indexterm" name="id3338226"></a><pre class="programlisting">struct GCache;</pre><p>
The <a href="glib-Caches.html#GCache"><span class="type">GCache</span></a> struct is an opaque data structure containing information about
a <a href="glib-Caches.html#GCache"><span class="type">GCache</span></a>. It should only be accessed via the following functions.
</p></div><hr><div class="refsect2" lang="en"><a name="id3338259"></a><h3><a name="g-cache-new"></a>g_cache_new ()</h3><a class="indexterm" name="id3338269"></a><pre class="programlisting"><a href="glib-Caches.html#GCache">GCache</a>*     g_cache_new                     (<a href="glib-Caches.html#GCacheNewFunc">GCacheNewFunc</a> value_new_func,
                                             <a href="glib-Caches.html#GCacheDestroyFunc">GCacheDestroyFunc</a> value_destroy_func,
                                             <a href="glib-Caches.html#GCacheDupFunc">GCacheDupFunc</a> key_dup_func,
                                             <a href="glib-Caches.html#GCacheDestroyFunc">GCacheDestroyFunc</a> key_destroy_func,
                                             <a href="glib-Hash-Tables.html#GHashFunc">GHashFunc</a> hash_key_func,
                                             <a href="glib-Hash-Tables.html#GHashFunc">GHashFunc</a> hash_value_func,
                                             <a href="glib-Hash-Tables.html#GEqualFunc">GEqualFunc</a> key_equal_func);</pre><p>
Creates a new <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"><i class="parameter"><tt>value_new_func</tt></i> :</span></td><td>a function to create a new object given a key.
This is called by <a href="glib-Caches.html#g-cache-insert"><tt class="function">g_cache_insert()</tt></a> if an object with the given key
does not already exist.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>value_destroy_func</tt></i> :</span></td><td>a function to destroy an object. It is
called by <a href="glib-Caches.html#g-cache-remove"><tt class="function">g_cache_remove()</tt></a> when the object is no longer needed (i.e. its
reference count drops to 0).
</td></tr><tr><td><span class="term"><i class="parameter"><tt>key_dup_func</tt></i> :</span></td><td>a function to copy a key. It is called by
<a href="glib-Caches.html#g-cache-insert"><tt class="function">g_cache_insert()</tt></a> if the key does not already exist in the <a href="glib-Caches.html#GCache"><span class="type">GCache</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>key_destroy_func</tt></i> :</span></td><td>a function to destroy a key. It is
called by <a href="glib-Caches.html#g-cache-remove"><tt class="function">g_cache_remove()</tt></a> when the object is no longer needed (i.e. its
reference count drops to 0).
</td></tr><tr><td><span class="term"><i class="parameter"><tt>hash_key_func</tt></i> :</span></td><td>a function to create a hash value from a key.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>hash_value_func</tt></i> :</span></td><td>a function to create a hash value from a value.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>key_equal_func</tt></i> :</span></td><td>a function to compare two keys. It should return <tt class="literal">TRUE</tt> if
the two keys are equivalent.
</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>.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3338539"></a><h3><a name="g-cache-insert"></a>g_cache_insert ()</h3><a class="indexterm" name="id3338549"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gpointer">gpointer</a>    g_cache_insert                  (<a href="glib-Caches.html#GCache">GCache</a> *cache,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> key);</pre><p>
Gets the value corresponding to the given key, creating it if necessary.
It first checks if the value already exists in the <a href="glib-Caches.html#GCache"><span class="type">GCache</span></a>, by using
the <i class="parameter"><tt>key_equal_func</tt></i> function passed to <a href="glib-Caches.html#g-cache-new"><tt class="function">g_cache_new()</tt></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
<i class="parameter"><tt>value_new_func</tt></i>. The key is duplicated by calling
<i class="parameter"><tt>key_dup_func</tt></i> and the duplicated key and value are inserted
into 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"><i class="parameter"><tt>cache</tt></i> :</span></td><td>a <a href="glib-Caches.html#GCache"><span class="type">GCache</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>key</tt></i> :</span></td><td>a key describing a <a href="glib-Caches.html#GCache"><span class="type">GCache</span></a> object.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>a pointer to a <a href="glib-Caches.html#GCache"><span class="type">GCache</span></a> value.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3338701"></a><h3><a name="g-cache-remove"></a>g_cache_remove ()</h3><a class="indexterm" name="id3338712"></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 <i class="parameter"><tt>value_destroy_func</tt></i> and <i class="parameter"><tt>key_destroy_func</tt></i> passed to <a href="glib-Caches.html#g-cache-new"><tt class="function">g_cache_new()</tt></a>.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>cache</tt></i> :</span></td><td>a <a href="glib-Caches.html#GCache"><span class="type">GCache</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>value</tt></i> :</span></td><td>the value to remove.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3338813"></a><h3><a name="g-cache-destroy"></a>g_cache_destroy ()</h3><a class="indexterm" name="id3338824"></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"><i class="parameter"><tt>cache</tt></i> :</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="id3338899"></a><h3><a name="g-cache-key-foreach"></a>g_cache_key_foreach ()</h3><a class="indexterm" name="id3338910"></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"><i class="parameter"><tt>cache</tt></i> :</span></td><td>a <a href="glib-Caches.html#GCache"><span class="type">GCache</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>func</tt></i> :</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"><i class="parameter"><tt>user_data</tt></i> :</span></td><td>user data to pass to the function.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3339024"></a><h3><a name="g-cache-value-foreach"></a>g_cache_value_foreach ()</h3><a class="indexterm" name="id3339035"></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"><i class="parameter"><tt>cache</tt></i> :</span></td><td>a <a href="glib-Caches.html#GCache"><span class="type">GCache</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>func</tt></i> :</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"><i class="parameter"><tt>user_data</tt></i> :</span></td><td>user data to pass to the function.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3339150"></a><h3><a name="GCacheDestroyFunc"></a>GCacheDestroyFunc ()</h3><a class="indexterm" name="id3339161"></a><pre class="programlisting">void        (*GCacheDestroyFunc)            (<a href="glib-Basic-Types.html#gpointer">gpointer</a> value);</pre><p>
Specifies the type of the <i class="parameter"><tt>value_destroy_func</tt></i> and <i class="parameter"><tt>key_destroy_func</tt></i> functions
passed to <a href="glib-Caches.html#g-cache-new"><tt class="function">g_cache_new()</tt></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 and
should 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"><i class="parameter"><tt>value</tt></i> :</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="id3339256"></a><h3><a name="GCacheDupFunc"></a>GCacheDupFunc ()</h3><a class="indexterm" name="id3339267"></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 <i class="parameter"><tt>key_dup_func</tt></i> function passed to <a href="glib-Caches.html#g-cache-new"><tt class="function">g_cache_new()</tt></a>.
The function is passed a key (<span class="emphasis"><em>not</em></span> a value as the prototype implies) and
should return a duplicate of the key.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>value</tt></i> :</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="id3339373"></a><h3><a name="GCacheNewFunc"></a>GCacheNewFunc ()</h3><a class="indexterm" name="id3339384"></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 <i class="parameter"><tt>value_new_func</tt></i> function passed to <a href="glib-Caches.html#g-cache-new"><tt class="function">g_cache_new()</tt></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 the
key.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>key</tt></i> :</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>&lt;&lt; Relations and Tuples</b></a></td><td align="right"><a accesskey="n" href="glib-Memory-Allocators.html"><b>Memory Allocators &gt;&gt;</b></a></td></tr></table></body></html>