## ECalBackendCache

ECalBackendCache — Cache for calendar backends.

## Synopsis

                        ECalBackendCache;
    ECalBackendCache *  e_cal_backend_cache_new             (const gchar *filename);
    ECalComponent *     e_cal_backend_cache_get_component   (ECalBackendCache *cache,
                                                             const gchar *uid,
                                                             const gchar *rid);
    gboolean            e_cal_backend_cache_put_component   (ECalBackendCache *cache,
                                                             ECalComponent *comp);
    gboolean            e_cal_backend_cache_remove_component
                                                            (ECalBackendCache *cache,
                                                             const gchar *uid,
                                                             const gchar *rid);
    GList *             e_cal_backend_cache_get_components  (ECalBackendCache *cache);
    GSList *            e_cal_backend_cache_get_components_by_uid
                                                            (ECalBackendCache *cache,
                                                             const gchar *uid);
    const icaltimezone * e_cal_backend_cache_get_timezone   (ECalBackendCache *cache,
                                                             const gchar *tzid);
    gboolean            e_cal_backend_cache_put_timezone    (ECalBackendCache *cache,
                                                             const icaltimezone *zone);
    gboolean            e_cal_backend_cache_remove_timezone (ECalBackendCache *cache,
                                                             const gchar *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 gchar *       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 gchar *utc_str);
    const gchar *       e_cal_backend_cache_get_server_utc_time
                                                            (ECalBackendCache *cache);
    gboolean            e_cal_backend_cache_put_key_value   (ECalBackendCache *cache,
                                                             const gchar *key,
                                                             const gchar *value);
    const gchar *       e_cal_backend_cache_get_key_value   (ECalBackendCache *cache,
                                                             const gchar *key);
    gboolean            e_cal_backend_cache_remove          (const gchar *dirname,
                                                             const gchar *basename);

## Object Hierarchy

      GObject
       +----EFileCache
             +----ECalBackendCache

## Description

## Details

### ECalBackendCache

    typedef struct _ECalBackendCache ECalBackendCache;

### e_cal_backend_cache_new ()

    ECalBackendCache *  e_cal_backend_cache_new             (const gchar *filename);

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

`filename` : | filename for cache data
Returns : | a new ECalBackendCache

### e_cal_backend_cache_get_component ()

    ECalComponent *     e_cal_backend_cache_get_component   (ECalBackendCache *cache,
                                                             const gchar *uid,
                                                             const gchar *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 gchar *uid,
                                                             const gchar *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_components_by_uid ()

    GSList *            e_cal_backend_cache_get_components_by_uid
                                                            (ECalBackendCache *cache,
                                                             const gchar *uid);

Retrieves a ical components from the cache.

`cache` : | An ECalBackendCache object.
`uid` : | ID of the component to retrieve.
Returns : | The list of calendar components if found, or NULL otherwise.

### e_cal_backend_cache_get_timezone ()

    const icaltimezone * e_cal_backend_cache_get_timezone   (ECalBackendCache *cache,
                                                             const gchar *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 gchar *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 gchar *       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 gchar *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 gchar *       e_cal_backend_cache_get_server_utc_time
                                                            (ECalBackendCache *cache);

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

### e_cal_backend_cache_put_key_value ()

    gboolean            e_cal_backend_cache_put_key_value   (ECalBackendCache *cache,
                                                             const gchar *key,
                                                             const gchar *value);

`cache` : | An ECalBackendCache object.
`key` : |
`value` : |
Returns : | TRUE if the operation was successful, FALSE otherwise.

### e_cal_backend_cache_get_key_value ()

    const gchar *       e_cal_backend_cache_get_key_value   (ECalBackendCache *cache,
                                                             const gchar *key);

`cache` : | An ECalBackendCache object.
`key` : |
Returns : | The value.

### e_cal_backend_cache_remove ()

    gboolean            e_cal_backend_cache_remove          (const gchar *dirname,
                                                             const gchar *basename);

`dirname` : |
`basename` : |
Returns : |

Since 2.28