e-book-backend-db-cache
3
LIBEDATA-BOOK Library

# e-book-backend-db-cache

## Synopsis

    EContact*           e_book_backend_db_cache_get_contact (DB *db,
                                                             const char *uid);
    void                string_to_dbt                       (const char *str,
                                                             DBT *dbt);
    char *              e_book_backend_db_cache_get_filename
                                                            (DB *db);
    void                e_book_backend_db_cache_set_filename
                                                            (DB *db,
                                                             const char *filename);
    gboolean            e_book_backend_db_cache_add_contact (DB *db,
                                                             EContact *contact);
    gboolean            e_book_backend_db_cache_remove_contact
                                                            (DB *db,
                                                             const char *uid);
    gboolean            e_book_backend_db_cache_check_contact
                                                            (DB *db,
                                                             const char *uid);
    GList*              e_book_backend_db_cache_get_contacts
                                                            (DB *db,
                                                             const char *query);
    gboolean            e_book_backend_db_cache_exists      (const char *uri);
    void                e_book_backend_db_cache_set_populated
                                                            (DB *db);
    gboolean            e_book_backend_db_cache_is_populated
                                                            (DB *db);
    GPtrArray*          e_book_backend_db_cache_search      (DB *db,
                                                             const char *query);
    void                e_book_backend_db_cache_set_time    (DB *db,
                                                             const char *t);
    char *              e_book_backend_db_cache_get_time    (DB *db);

## Description

## Details

### e_book_backend_db_cache_get_contact ()

    EContact*           e_book_backend_db_cache_get_contact (DB *db,
                                                             const char *uid);

Get a cached contact. Note that the returned EContact will be newly created, and must be unreffed by the caller when no longer needed.

`db` :

  DB Handle

`uid` :

  a unique contact ID

Returns :

  A cached EContact, or `NULL` if `uid` is not cached.

### string_to_dbt ()

    void                string_to_dbt                       (const char *str,
                                                             DBT *dbt);

`str` :

`dbt` :

### e_book_backend_db_cache_get_filename ()

    char *              e_book_backend_db_cache_get_filename
                                                            (DB *db);

Get the filename for db cacahe file.

`db` :

  DB Handle

Returns :

### e_book_backend_db_cache_set_filename ()

    void                e_book_backend_db_cache_set_filename
                                                            (DB *db,
                                                             const char *filename);

Set the filename for db cacahe file.

`db` :

  DB Handle

`filename` :

  filename to be set

### e_book_backend_db_cache_add_contact ()

    gboolean            e_book_backend_db_cache_add_contact (DB *db,
                                                             EContact *contact);

Adds `contact` to `cache`.

`db` :

  DB Handle

`contact` :

  an EContact

Returns :

  `TRUE` if the contact was cached successfully, `FALSE` otherwise.

### e_book_backend_db_cache_remove_contact ()

    gboolean            e_book_backend_db_cache_remove_contact
                                                            (DB *db,
                                                             const char *uid);

Removes the contact identified by `uid` from `cache`.

`db` :

  DB Handle

`uid` :

  a unique contact ID

Returns :

  `TRUE` if the contact was found and removed, `FALSE` otherwise.

### e_book_backend_db_cache_check_contact ()

    gboolean            e_book_backend_db_cache_check_contact
                                                            (DB *db,
                                                             const char *uid);

Checks if the contact identified by `uid` exists in `cache`.

`db` :

  DB Handle

`uid` :

  a unique contact ID

Returns :

  `TRUE` if the cache contains the contact, `FALSE` otherwise.

### e_book_backend_db_cache_get_contacts ()

    GList*              e_book_backend_db_cache_get_contacts
                                                            (DB *db,
                                                             const char *query);

Returns a list of EContact elements from `cache` matching `query`. When done with the list, the caller must unref the contacts and free the list.

`db` :

  DB Handle

`query` :

  an s-expression

Returns :

  A GList of pointers to EContact.

### e_book_backend_db_cache_exists ()

    gboolean            e_book_backend_db_cache_exists      (const char *uri);

Checks if an EBookBackendCache exists at `uri`.

`uri` :

  URI for the cache

Returns :

  `TRUE` if cache exists, `FALSE` if not.

### e_book_backend_db_cache_set_populated ()

    void                e_book_backend_db_cache_set_populated
                                                            (DB *db);

Flags `cache` as being populated - that is, it is up-to-date on the contents of the book it's caching.

`db` :

### e_book_backend_db_cache_is_populated ()

    gboolean            e_book_backend_db_cache_is_populated
                                                            (DB *db);

`db` :

Returns :

### e_book_backend_db_cache_search ()

    GPtrArray*          e_book_backend_db_cache_search      (DB *db,
                                                             const char *query);

Returns an array of pointers to unique contact ID strings for contacts in `cache` matching `query`. When done with the array, the caller must free the ID strings and the array.

`db` :

`query` :

  an s-expression

Returns :

  A GPtrArray of pointers to contact ID strings.

### e_book_backend_db_cache_set_time ()

    void                e_book_backend_db_cache_set_time    (DB *db,
                                                             const char *t);

`db` :

`t` :

### e_book_backend_db_cache_get_time ()

    char *              e_book_backend_db_cache_get_time    (DB *db);

`db` :

Returns :