## ECalBackendCache ECalBackendCache — A helper class for caching calendar components |

## Functions

ECalBackendCache * | e_cal_backend_cache_new ()
ECalComponent * | e_cal_backend_cache_get_component ()
gboolean | e_cal_backend_cache_put_component ()
gboolean | e_cal_backend_cache_remove_component ()
GList * | e_cal_backend_cache_get_components ()
GSList * | e_cal_backend_cache_get_components_by_uid ()
const icaltimezone * | e_cal_backend_cache_get_timezone ()
gboolean | e_cal_backend_cache_put_timezone ()
gboolean | e_cal_backend_cache_put_default_timezone ()
icaltimezone * | e_cal_backend_cache_get_default_timezone ()
GSList * | e_cal_backend_cache_get_keys ()
const gchar * | e_cal_backend_cache_get_marker ()
void | e_cal_backend_cache_set_marker ()
gboolean | e_cal_backend_cache_put_server_utc_time ()
const gchar * | e_cal_backend_cache_get_server_utc_time ()
gboolean | e_cal_backend_cache_put_key_value ()
const gchar * | e_cal_backend_cache_get_key_value ()
gboolean | e_cal_backend_cache_remove ()

## Types and Values

struct | ECalBackendCache
struct | ECalBackendCacheClass

## Includes

    #include <libedata-cal/libedata-cal.h>

## Description

This class can be used by backends to store calendar components.

## Functions

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

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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_put_default_timezone ()

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

Sets the default timezone on the cache.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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);

#### Parameters

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);

#### Parameters

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);

#### Parameters

cache | An ECalBackendCache object. |
key | The Key parameter to identify uniquely. |
value | The value for the `key` parameter. |

#### 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);

#### Parameters

cache | An ECalBackendCache object. |
key | The key to fetch a value for |

#### Returns

The value.

[transfer none]

### e_cal_backend_cache_remove ()

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

Removes the cache directory

#### Parameters

dirname | The directory name where the cache is stored |
basename | The directory inside `dirname` where the cache is stored |

Since 2.28

## Types and Values

### struct ECalBackendCache

    struct ECalBackendCache {
    };

Contains only private data that should be read and manipulated using the functions below.

### struct ECalBackendCacheClass

    struct ECalBackendCacheClass {
    };

Class structure for the ECalBackendCache.