<refentry id="camel-CamelDataCache">
<refmeta>
<refentrytitle role="top_of_page" id="camel-CamelDataCache.top_of_page">CamelDataCache</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>CAMEL Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>CamelDataCache</refname>
<refpurpose></refpurpose>
</refnamediv>

<refsynopsisdiv id="camel-CamelDataCache.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>
                    <link linkend="CamelDataCache">CamelDataCache</link>;
<link linkend="CamelDataCache">CamelDataCache</link> *    <link linkend="camel-data-cache-new">camel_data_cache_new</link>                (const <link linkend="char">char</link> *path,
                                                         <link linkend="guint32">guint32</link> flags,
                                                         <link linkend="CamelException">CamelException</link> *ex);
<link linkend="void">void</link>                <link linkend="camel-data-cache-set-expire-age">camel_data_cache_set_expire_age</link>     (<link linkend="CamelDataCache">CamelDataCache</link> *cdc,
                                                         <link linkend="time-t">time_t</link> when);
<link linkend="void">void</link>                <link linkend="camel-data-cache-set-expire-access">camel_data_cache_set_expire_access</link>  (<link linkend="CamelDataCache">CamelDataCache</link> *cdc,
                                                         <link linkend="time-t">time_t</link> when);
<link linkend="int">int</link>                 <link linkend="camel-data-cache-rename">camel_data_cache_rename</link>             (<link linkend="CamelDataCache">CamelDataCache</link> *cache,
                                                         const <link linkend="char">char</link> *old,
                                                         const <link linkend="char">char</link> *new,
                                                         <link linkend="CamelException">CamelException</link> *ex);
<link linkend="CamelStream">CamelStream</link> *       <link linkend="camel-data-cache-add">camel_data_cache_add</link>                (<link linkend="CamelDataCache">CamelDataCache</link> *cdc,
                                                         const <link linkend="char">char</link> *path,
                                                         const <link linkend="char">char</link> *key,
                                                         <link linkend="CamelException">CamelException</link> *ex);
<link linkend="CamelStream">CamelStream</link> *       <link linkend="camel-data-cache-get">camel_data_cache_get</link>                (<link linkend="CamelDataCache">CamelDataCache</link> *cdc,
                                                         const <link linkend="char">char</link> *path,
                                                         const <link linkend="char">char</link> *key,
                                                         <link linkend="CamelException">CamelException</link> *ex);
<link linkend="int">int</link>                 <link linkend="camel-data-cache-remove">camel_data_cache_remove</link>             (<link linkend="CamelDataCache">CamelDataCache</link> *cdc,
                                                         const <link linkend="char">char</link> *path,
                                                         const <link linkend="char">char</link> *key,
                                                         <link linkend="CamelException">CamelException</link> *ex);
<link linkend="int">int</link>                 <link linkend="camel-data-cache-clear">camel_data_cache_clear</link>              (<link linkend="CamelDataCache">CamelDataCache</link> *cache,
                                                         const <link linkend="char">char</link> *path,
                                                         <link linkend="CamelException">CamelException</link> *ex);
</synopsis>
</refsynopsisdiv>









<refsect1 id="camel-CamelDataCache.description" role="desc">
<title role="desc.title">Description</title>
<para>
</para>
</refsect1>

<refsect1 id="camel-CamelDataCache.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="CamelDataCache" role="struct">
<title>CamelDataCache</title>
<indexterm zone="CamelDataCache"><primary sortas="CamelDataCache">CamelDataCache</primary></indexterm><programlisting>typedef struct {
	CamelObject parent_object;

	struct _CamelDataCachePrivate *priv;

	char *path;
	guint32 flags;

	time_t expire_age;
	time_t expire_access;
} CamelDataCache;
</programlisting>
<para>
</para></refsect2>
<refsect2 id="camel-data-cache-new" role="function">
<title>camel_data_cache_new ()</title>
<indexterm zone="camel-data-cache-new"><primary sortas="camel_data_cache_new">camel_data_cache_new</primary></indexterm><programlisting><link linkend="CamelDataCache">CamelDataCache</link> *    camel_data_cache_new                (const <link linkend="char">char</link> *path,
                                                         <link linkend="guint32">guint32</link> flags,
                                                         <link linkend="CamelException">CamelException</link> *ex);</programlisting>
<para>
Create a new data cache.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>path</parameter>&#160;:</term>
<listitem><simpara> Base path of cache, subdirectories will be created here.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>flags</parameter>&#160;:</term>
<listitem><simpara> Open flags, none defined.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ex</parameter>&#160;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> A new cache object, or NULL if the base path cannot
be written to.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-data-cache-set-expire-age" role="function">
<title>camel_data_cache_set_expire_age ()</title>
<indexterm zone="camel-data-cache-set-expire-age"><primary sortas="camel_data_cache_set_expire_age">camel_data_cache_set_expire_age</primary></indexterm><programlisting><link linkend="void">void</link>                camel_data_cache_set_expire_age     (<link linkend="CamelDataCache">CamelDataCache</link> *cdc,
                                                         <link linkend="time-t">time_t</link> when);</programlisting>
<para>
Set the cache expiration policy for aged entries.
</para>
<para>
Items in the cache older than <parameter>when</parameter> seconds may be
flushed at any time.  Items are expired in a lazy
manner, so it is indeterminate when the items will
physically be removed.
</para>
<para>
Note you can set both an age and an access limit.  The
age acts as a hard limit on cache entries.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cdc</parameter>&#160;:</term>
<listitem><simpara> A <link linkend="CamelDataCache"><type>CamelDataCache</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>when</parameter>&#160;:</term>
<listitem><simpara> Timeout for age expiry, or -1 to disable.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-data-cache-set-expire-access" role="function">
<title>camel_data_cache_set_expire_access ()</title>
<indexterm zone="camel-data-cache-set-expire-access"><primary sortas="camel_data_cache_set_expire_access">camel_data_cache_set_expire_access</primary></indexterm><programlisting><link linkend="void">void</link>                camel_data_cache_set_expire_access  (<link linkend="CamelDataCache">CamelDataCache</link> *cdc,
                                                         <link linkend="time-t">time_t</link> when);</programlisting>
<para>
Set the cache expiration policy for access times.
</para>
<para>
Items in the cache which haven't been accessed for <parameter>when</parameter>
seconds may be expired at any time.  Items are expired in a lazy
manner, so it is indeterminate when the items will
physically be removed.
</para>
<para>
Note you can set both an age and an access limit.  The
age acts as a hard limit on cache entries.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cdc</parameter>&#160;:</term>
<listitem><simpara> A <link linkend="CamelDataCache"><type>CamelDataCache</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>when</parameter>&#160;:</term>
<listitem><simpara> Timeout for access, or -1 to disable access expiry.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-data-cache-rename" role="function">
<title>camel_data_cache_rename ()</title>
<indexterm zone="camel-data-cache-rename"><primary sortas="camel_data_cache_rename">camel_data_cache_rename</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_data_cache_rename             (<link linkend="CamelDataCache">CamelDataCache</link> *cache,
                                                         const <link linkend="char">char</link> *old,
                                                         const <link linkend="char">char</link> *new,
                                                         <link linkend="CamelException">CamelException</link> *ex);</programlisting>
<para>
Rename a cache path.  All cache items accessed from the old path
are accessible using the new path.
</para>
<para>
CURRENTLY UNIMPLEMENTED</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cache</parameter>&#160;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>old</parameter>&#160;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>new</parameter>&#160;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ex</parameter>&#160;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> -1 on error.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-data-cache-add" role="function">
<title>camel_data_cache_add ()</title>
<indexterm zone="camel-data-cache-add"><primary sortas="camel_data_cache_add">camel_data_cache_add</primary></indexterm><programlisting><link linkend="CamelStream">CamelStream</link> *       camel_data_cache_add                (<link linkend="CamelDataCache">CamelDataCache</link> *cdc,
                                                         const <link linkend="char">char</link> *path,
                                                         const <link linkend="char">char</link> *key,
                                                         <link linkend="CamelException">CamelException</link> *ex);</programlisting>
<para>
Add a new item to the cache.
</para>
<para>
The key and the path combine to form a unique key used to store
the item.
</para>
<para>
Potentially, expiry processing will be performed while this call
is executing.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cdc</parameter>&#160;:</term>
<listitem><simpara> A <link linkend="CamelDataCache"><type>CamelDataCache</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>path</parameter>&#160;:</term>
<listitem><simpara> Relative path of item to add.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>key</parameter>&#160;:</term>
<listitem><simpara> Key of item to add.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ex</parameter>&#160;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> A CamelStream (file) opened in read-write mode.
The caller must unref this when finished.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-data-cache-get" role="function">
<title>camel_data_cache_get ()</title>
<indexterm zone="camel-data-cache-get"><primary sortas="camel_data_cache_get">camel_data_cache_get</primary></indexterm><programlisting><link linkend="CamelStream">CamelStream</link> *       camel_data_cache_get                (<link linkend="CamelDataCache">CamelDataCache</link> *cdc,
                                                         const <link linkend="char">char</link> *path,
                                                         const <link linkend="char">char</link> *key,
                                                         <link linkend="CamelException">CamelException</link> *ex);</programlisting>
<para>
Lookup an item in the cache.  If the item exists, a stream
is returned for the item.  The stream may be shared by
multiple callers, so ensure the stream is in a valid state
through external locking.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cdc</parameter>&#160;:</term>
<listitem><simpara> A <link linkend="CamelDataCache"><type>CamelDataCache</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>path</parameter>&#160;:</term>
<listitem><simpara> Path to the (sub) cache the item exists in.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>key</parameter>&#160;:</term>
<listitem><simpara> Key for the cache item.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ex</parameter>&#160;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> A cache item, or NULL if the cache item does not exist.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-data-cache-remove" role="function">
<title>camel_data_cache_remove ()</title>
<indexterm zone="camel-data-cache-remove"><primary sortas="camel_data_cache_remove">camel_data_cache_remove</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_data_cache_remove             (<link linkend="CamelDataCache">CamelDataCache</link> *cdc,
                                                         const <link linkend="char">char</link> *path,
                                                         const <link linkend="char">char</link> *key,
                                                         <link linkend="CamelException">CamelException</link> *ex);</programlisting>
<para>
Remove/expire a cache item.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cdc</parameter>&#160;:</term>
<listitem><simpara> A <link linkend="CamelDataCache"><type>CamelDataCache</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>path</parameter>&#160;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>key</parameter>&#160;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ex</parameter>&#160;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> 
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="camel-data-cache-clear" role="function">
<title>camel_data_cache_clear ()</title>
<indexterm zone="camel-data-cache-clear"><primary sortas="camel_data_cache_clear">camel_data_cache_clear</primary></indexterm><programlisting><link linkend="int">int</link>                 camel_data_cache_clear              (<link linkend="CamelDataCache">CamelDataCache</link> *cache,
                                                         const <link linkend="char">char</link> *path,
                                                         <link linkend="CamelException">CamelException</link> *ex);</programlisting>
<para>
Clear all items in a given cache path or all items in the cache.
</para>
<para>
CURRENTLY_UNIMPLEMENTED</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>cache</parameter>&#160;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>path</parameter>&#160;:</term>
<listitem><simpara> Path to clear, or NULL to clear all items in all paths.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ex</parameter>&#160;:</term>
<listitem><simpara> 
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> -1 on error.
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>




</refentry>
