CamelImapMessageCache
3
CAMEL Library

# CamelImapMessageCache

## Synopsis

    struct              CamelImapMessageCache;
    CamelImapMessageCache * camel_imap_message_cache_new    (const gchar *path,
                                                             CamelFolderSummary *summary,
                                                             CamelException *ex);
    void                camel_imap_message_cache_set_path   (CamelImapMessageCache *cache,
                                                             const gchar *path);
    guint32             camel_imap_message_cache_max_uid    (CamelImapMessageCache *cache);
    CamelStream *       camel_imap_message_cache_insert     (CamelImapMessageCache *cache,
                                                             const gchar *uid,
                                                             const gchar *part_spec,
                                                             const gchar *data,
                                                             gint len,
                                                             CamelException *ex);
    void                camel_imap_message_cache_insert_stream
                                                            (CamelImapMessageCache *cache,
                                                             const gchar *uid,
                                                             const gchar *part_spec,
                                                             CamelStream *data_stream,
                                                             CamelException *ex);
    void                camel_imap_message_cache_insert_wrapper
                                                            (CamelImapMessageCache *cache,
                                                             const gchar *uid,
                                                             const gchar *part_spec,
                                                             CamelDataWrapper *wrapper,
                                                             CamelException *ex);
    CamelStream *       camel_imap_message_cache_get        (CamelImapMessageCache *cache,
                                                             const gchar *uid,
                                                             const gchar *part_spec,
                                                             CamelException *ex);
    gchar *             camel_imap_message_cache_get_filename
                                                            (CamelImapMessageCache *cache,
                                                             const gchar *uid,
                                                             const gchar *part_spec,
                                                             CamelException *ex);
    void                camel_imap_message_cache_remove     (CamelImapMessageCache *cache,
                                                             const gchar *uid);
    void                camel_imap_message_cache_clear      (CamelImapMessageCache *cache);
    void                camel_imap_message_cache_copy       (CamelImapMessageCache *source,
                                                             const gchar *source_uid,
                                                             CamelImapMessageCache *dest,
                                                             const gchar *dest_uid,
                                                             CamelException *ex);
    gboolean            camel_imap_message_cache_delete     (const gchar *path,
                                                             CamelException *ex);
    GPtrArray *         camel_imap_message_cache_filter_cached
                                                            (CamelImapMessageCache *,
                                                             GPtrArray *uids,
                                                             CamelException *ex);

## Description

## Details

### struct CamelImapMessageCache

    struct CamelImapMessageCache {
    	CamelObject parent_object;

    	gchar *path;
            /* parts contains two sorts of objects.
             * If the key contains '.' then it is a stream (also reverse-indexed in
             * cached).
             * Otherwise it is a g_ptr_array containing the subparts the message
             * has. (e.g. 0., or 0.MIME.1).
             */
            /* cached contains streams for recently accessed messages */
    	GHashTable *parts, *cached;
    	guint32 max_uid;
    };

### camel_imap_message_cache_new ()

    CamelImapMessageCache * camel_imap_message_cache_new    (const gchar *path,
                                                             CamelFolderSummary *summary,
                                                             CamelException *ex);

`path` :

  directory to use for storage

`summary` :

  CamelFolderSummary for the folder we are caching

`ex` :

  a CamelException

Returns :

  a new CamelImapMessageCache object using `path` for storage. If cache files already exist in `path`, then any that do not correspond to messages in `summary` will be deleted. `path` is scanned for its contents, which means creating a cache object can be expensive, but the parts hash is immediately usable.

### camel_imap_message_cache_set_path ()

    void                camel_imap_message_cache_set_path   (CamelImapMessageCache *cache,
                                                             const gchar *path);

Set the path used for the message cache.

`cache` :

`path` :

### camel_imap_message_cache_max_uid ()

    guint32             camel_imap_message_cache_max_uid    (CamelImapMessageCache *cache);

`cache` :

  the cache

Returns :

  the largest (real) UID in the cache.

### camel_imap_message_cache_insert ()

    CamelStream *       camel_imap_message_cache_insert     (CamelImapMessageCache *cache,
                                                             const gchar *uid,
                                                             const gchar *part_spec,
                                                             const gchar *data,
                                                             gint len,
                                                             CamelException *ex);

Caches the provided data into `cache`.

`cache` :

  the cache

`uid` :

  UID of the message data to cache

`part_spec` :

  the IMAP part_spec of the data

`data` :

  the data

`len` :

  length of `data`

`ex` :

Returns :

  a CamelStream containing the cached data, which the caller must unref.

### camel_imap_message_cache_insert_stream ()

    void                camel_imap_message_cache_insert_stream
                                                            (CamelImapMessageCache *cache,
                                                             const gchar *uid,
                                                             const gchar *part_spec,
                                                             CamelStream *data_stream,
                                                             CamelException *ex);

Caches the provided data into `cache`.

`cache` :

  the cache

`uid` :

  UID of the message data to cache

`part_spec` :

  the IMAP part_spec of the data

`data_stream` :

  the stream to cache

`ex` :

### camel_imap_message_cache_insert_wrapper ()

    void                camel_imap_message_cache_insert_wrapper
                                                            (CamelImapMessageCache *cache,
                                                             const gchar *uid,
                                                             const gchar *part_spec,
                                                             CamelDataWrapper *wrapper,
                                                             CamelException *ex);

Caches the provided data into `cache`.

`cache` :

  the cache

`uid` :

  UID of the message data to cache

`part_spec` :

  the IMAP part_spec of the data

`wrapper` :

  the wrapper to cache

`ex` :

### camel_imap_message_cache_get ()

    CamelStream *       camel_imap_message_cache_get        (CamelImapMessageCache *cache,
                                                             const gchar *uid,
                                                             const gchar *part_spec,
                                                             CamelException *ex);

`cache` :

  the cache

`uid` :

  the UID of the data to get

`part_spec` :

  the part_spec of the data to get

`ex` :

  exception

Returns :

  a CamelStream containing the cached data (which the caller must unref), or `NULL` if that data is not cached.

### camel_imap_message_cache_get_filename ()

    gchar *             camel_imap_message_cache_get_filename
                                                            (CamelImapMessageCache *cache,
                                                             const gchar *uid,
                                                             const gchar *part_spec,
                                                             CamelException *ex);

`cache` :

  the cache

`uid` :

  the UID of the data to get

`part_spec` :

  the part_spec of the data to get

`ex` :

  exception

Returns :

  the filename of a cache item

### camel_imap_message_cache_remove ()

    void                camel_imap_message_cache_remove     (CamelImapMessageCache *cache,
                                                             const gchar *uid);

Removes all data associated with `uid` from `cache`.

`cache` :

  the cache

`uid` :

  UID of the data to remove

### camel_imap_message_cache_clear ()

    void                camel_imap_message_cache_clear      (CamelImapMessageCache *cache);

Removes all cached data from `cache`.

`cache` :

  the cache

### camel_imap_message_cache_copy ()

    void                camel_imap_message_cache_copy       (CamelImapMessageCache *source,
                                                             const gchar *source_uid,
                                                             CamelImapMessageCache *dest,
                                                             const gchar *dest_uid,
                                                             CamelException *ex);

Copies all cached parts from `source_uid` in `source` to `dest_uid` in `destination`.

`source` :

  the source message cache

`source_uid` :

  UID of a message in `source`

`dest` :

  the destination message cache

`dest_uid` :

  UID of the message in `dest`

`ex` :

### camel_imap_message_cache_delete ()

    gboolean            camel_imap_message_cache_delete     (const gchar *path,
                                                             CamelException *ex);

All the files under this directory would be deleted

`path` :

  directory to use for storage

`ex` :

  a CamelException

Returns :

### camel_imap_message_cache_filter_cached ()

    GPtrArray *         camel_imap_message_cache_filter_cached
                                                            (CamelImapMessageCache *,
                                                             GPtrArray *uids,
                                                             CamelException *ex);

`Param1` :

`uids` :

`ex` :

Returns :