## ECalBackendCache ECalBackendCache — Cache for calendar backends. |

## Synopsis

                ECalBackendCachePrivate;
    ECalBackendCache* e_cal_backend_cache_new   (const char *uri,
                                                 ECalSourceType source_type);
    ECalComponent* e_cal_backend_cache_get_component
                                                (ECalBackendCache *cache,
                                                 const char *uid,
                                                 const char *rid);
    gboolean    e_cal_backend_cache_put_component
                                                (ECalBackendCache *cache,
                                                 ECalComponent *comp);
    gboolean    e_cal_backend_cache_remove_component
                                                (ECalBackendCache *cache,
                                                 const char *uid,
                                                 const char *rid);
    GList*      e_cal_backend_cache_get_components
                                                (ECalBackendCache *cache);
    const icaltimezone* e_cal_backend_cache_get_timezone
                                                (ECalBackendCache *cache,
                                                 const char *tzid);
    gboolean    e_cal_backend_cache_put_timezone
                                                (ECalBackendCache *cache,
                                                 const icaltimezone *zone);
    gboolean    e_cal_backend_cache_remove_timezone
                                                (ECalBackendCache *cache,
                                                 const char *tzid);
    gboolean    e_cal_backend_cache_put_default_timezone
                                                (ECalBackendCache *cache,
                                                 icaltimezone *default_zone);
    icaltimezone* e_cal_backend_cache_get_default_timezone
                                                (ECalBackendCache *cache);
    GSList*     e_cal_backend_cache_get_keys    (ECalBackendCache *cache);
    const char* e_cal_backend_cache_get_marker  (ECalBackendCache *cache);
    void        e_cal_backend_cache_set_marker  (ECalBackendCache *cache);
    gboolean    e_cal_backend_cache_put_server_utc_time
                                                (ECalBackendCache *cache,
                                                 const char *utc_str);
    const char* e_cal_backend_cache_get_server_utc_time
                                                (ECalBackendCache *cache);

## Description

## Details

### ECalBackendCachePrivate

    typedef struct _ECalBackendCachePrivate ECalBackendCachePrivate;

### e_cal_backend_cache_new ()

    ECalBackendCache* e_cal_backend_cache_new   (const char *uri,
                                                 ECalSourceType source_type);

Creates a new ECalBackendCache object, which implements a cache of calendar/tasks objects, very useful for remote backends.

`uri` : | URI of the backend to be cached.
`source_type` : |
Returns : | The newly created object.

### e_cal_backend_cache_get_component ()

    ECalComponent* e_cal_backend_cache_get_component
                                                (ECalBackendCache *cache,
                                                 const char *uid,
                                                 const char *rid);

Gets a component from the `ECalBackendCache` object.

`cache` : | A `ECalBackendCache` object.
`uid` : | The UID of the component to retrieve.
`rid` : | Recurrence ID of the specific detached recurrence to retrieve, or NULL if the whole object is to be retrieved.
Returns : | The `ECalComponent` representing the component found, or `NULL` if it was not found in the cache.

### e_cal_backend_cache_put_component ()

    gboolean    e_cal_backend_cache_put_component
                                                (ECalBackendCache *cache,
                                                 ECalComponent *comp);

Puts the given calendar component in the given cache. This will add the component if it does not exist or replace it if there was a previous version of it.

`cache` : | An ECalBackendCache object.
`comp` : | Component to put on the cache.
Returns : | TRUE if the operation was successful, FALSE otherwise.

### e_cal_backend_cache_remove_component ()

    gboolean    e_cal_backend_cache_remove_component
                                                (ECalBackendCache *cache,
                                                 const char *uid,
                                                 const char *rid);

Removes a component from the cache.

`cache` : | An ECalBackendCache object.
`uid` : | UID of the component to remove.
`rid` : | Recurrence-ID of the component to remove. This is used when removing detached instances of a recurring appointment.
Returns : | TRUE if the component was removed, FALSE otherwise.

### e_cal_backend_cache_get_components ()

    GList*      e_cal_backend_cache_get_components
                                                (ECalBackendCache *cache);

Retrieves a list of all the components stored in the cache.

`cache` : | An ECalBackendCache object.
Returns : | A list of all the components. Each item in the list is an ECalComponent, which should be freed when no longer needed.

### e_cal_backend_cache_get_timezone ()

    const icaltimezone* e_cal_backend_cache_get_timezone
                                                (ECalBackendCache *cache,
                                                 const char *tzid);

Retrieves a timezone component from the cache.

`cache` : | An ECalBackendCache object.
`tzid` : | ID of the timezone to retrieve.
Returns : | The timezone if found, or NULL otherwise.

### e_cal_backend_cache_put_timezone ()

    gboolean    e_cal_backend_cache_put_timezone
                                                (ECalBackendCache *cache,
                                                 const icaltimezone *zone);

Puts the given timezone in the cache, adding it, if it did not exist, or replacing it, if there was an older version.

`cache` : | An ECalBackendCache object.
`zone` : | The timezone to put on the cache.
Returns : | TRUE if the timezone was put on the cache, FALSE otherwise.

### e_cal_backend_cache_remove_timezone ()

    gboolean    e_cal_backend_cache_remove_timezone
                                                (ECalBackendCache *cache,
                                                 const char *tzid);

Removes a timezone component from the cache.

`cache` : | An ECalBackendCache object.
`tzid` : | ID of the timezone to remove.
Returns : | TRUE if the timezone was removed, FALSE otherwise.

### e_cal_backend_cache_put_default_timezone ()

    gboolean    e_cal_backend_cache_put_default_timezone
                                                (ECalBackendCache *cache,
                                                 icaltimezone *default_zone);

Sets the default timezone on the cache.

`cache` : | An ECalBackendCache object.
`default_zone` : | The default timezone.
Returns : | TRUE if the operation was successful, FALSE otherwise.

### e_cal_backend_cache_get_default_timezone ()

    icaltimezone* e_cal_backend_cache_get_default_timezone
                                                (ECalBackendCache *cache);

Retrieves the default timezone from the cache.

`cache` : | An ECalBackendCache object.
Returns : | The default timezone, or NULL if no default timezone has been set on the cache.

### e_cal_backend_cache_get_keys ()

    GSList*     e_cal_backend_cache_get_keys    (ECalBackendCache *cache);

Gets the list of unique keys in the cache file.

`cache` : | An ECalBackendCache object.
Returns : | A list of all the keys. The items in the list are pointers to internal data, so should not be freed, only the list should.

### e_cal_backend_cache_get_marker ()

    const char* e_cal_backend_cache_get_marker  (ECalBackendCache *cache);

Gets the marker of the cache. If this field is present, it means the cache has been populated.

`cache` : | An ECalBackendCache object.
Returns : | The value of the marker or NULL if the cache is still empty.

### e_cal_backend_cache_set_marker ()

    void        e_cal_backend_cache_set_marker  (ECalBackendCache *cache);

Marks the cache as populated, to discriminate between an empty calendar and an unpopulated one.

`cache` : | An ECalBackendCache object.

### e_cal_backend_cache_put_server_utc_time ()

    gboolean    e_cal_backend_cache_put_server_utc_time
                                                (ECalBackendCache *cache,
                                                 const char *utc_str);

`cache` : | An ECalBackendCache object.
`utc_str` : | UTC string.
Returns : | TRUE if the operation was successful, FALSE otherwise.

### e_cal_backend_cache_get_server_utc_time ()

    const char* e_cal_backend_cache_get_server_utc_time
                                                (ECalBackendCache *cache);

`cache` : | An ECalBackendCache object.
Returns : | The server's UTC string.