CamelImapMessageCache
3
CAMEL Library

# CamelImapMessageCache

## Synopsis

    struct              CamelImapMessageCache;
    CamelImapMessageCache* camel_imap_message_cache_new     (const char *path,
                                                             CamelFolderSummary *summ,
                                                             CamelException *ex);
    void                camel_imap_message_cache_set_path   (CamelImapMessageCache *cache,
                                                             const char *path);
    guint32             camel_imap_message_cache_max_uid    (CamelImapMessageCache *cache);
    CamelStream*        camel_imap_message_cache_insert     (CamelImapMessageCache *cache,
                                                             const char *uid,
                                                             const char *part_spec,
                                                             const char *data,
                                                             int len,
                                                             CamelException *ex);
    void                camel_imap_message_cache_insert_stream
                                                            (CamelImapMessageCache *cache,
                                                             const char *uid,
                                                             const char *part_spec,
                                                             CamelStream *data_stream,
                                                             CamelException *ex);
    void                camel_imap_message_cache_insert_wrapper
                                                            (CamelImapMessageCache *cache,
                                                             const char *uid,
                                                             const char *part_spec,
                                                             CamelDataWrapper *wrapper,
                                                             CamelException *ex);
    CamelStream*        camel_imap_message_cache_get        (CamelImapMessageCache *cache,
                                                             const char *uid,
                                                             const char *part_spec,
                                                             CamelException *ex);
    void                camel_imap_message_cache_remove     (CamelImapMessageCache *cache,
                                                             const char *uid);
    void                camel_imap_message_cache_clear      (CamelImapMessageCache *cache);
    void                camel_imap_message_cache_copy       (CamelImapMessageCache *source,
                                                             const char *source_uid,
                                                             CamelImapMessageCache *dest,
                                                             const char *dest_uid,
                                                             CamelException *ex);

## Description

## Details

### struct CamelImapMessageCache

    struct CamelImapMessageCache {
    	CamelObject parent_object;

    	char *path;
    	GHashTable *parts, *cached;
    	guint32 max_uid;
    };

### camel_imap_message_cache_new ()

    CamelImapMessageCache* camel_imap_message_cache_new     (const char *path,
                                                             CamelFolderSummary *summ,
                                                             CamelException *ex);

`path` :

  directory to use for storage

`summ` :

`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.

### camel_imap_message_cache_set_path ()

    void                camel_imap_message_cache_set_path   (CamelImapMessageCache *cache,
                                                             const char *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 char *uid,
                                                             const char *part_spec,
                                                             const char *data,
                                                             int 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 char *uid,
                                                             const char *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 char *uid,
                                                             const char *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 char *uid,
                                                             const char *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_remove ()

    void                camel_imap_message_cache_remove     (CamelImapMessageCache *cache,
                                                             const char *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 char *source_uid,
                                                             CamelImapMessageCache *dest,
                                                             const char *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` :