EDataBook.BookCache.new
Description: Reference for EDataBook.BookCache.new

### Constructor

# EDataBook BookCachenew

since: 3.26

#### Declaration [src]

    EBookCache*
    e_book_cache_new (
      const gchar* filename,
      ESource* source,
      GCancellable* cancellable,
      GError** error
    )

#### Description [src]

Creates a new `EBookCache` with the default summary configuration.

Aside from the mandatory fields `E_CONTACT_UID`, `E_CONTACT_REV`, the default configuration stores the following fields for quick performance of searches: `E_CONTACT_FILE_AS`, `E_CONTACT_NICKNAME`, `E_CONTACT_FULL_NAME`, `E_CONTACT_GIVEN_NAME`, `E_CONTACT_FAMILY_NAME`, `E_CONTACT_EMAIL`, `E_CONTACT_TEL`, `E_CONTACT_IS_LIST`, `E_CONTACT_LIST_SHOW_ADDRESSES`, and `E_CONTACT_WANTS_HTML`.

The fields `E_CONTACT_FULL_NAME` and `E_CONTACT_EMAIL` are configured to respond extra quickly with the `E_BOOK_INDEX_PREFIX` index flag.

The fields `E_CONTACT_FILE_AS`, `E_CONTACT_FAMILY_NAME` and `E_CONTACT_GIVEN_NAME` are configured to perform well with the `EBookCacheCursor`, using the `E_BOOK_INDEX_SORT_KEY` index flag.

Available since: 3.26

#### Parameters

`filename`

  Type: `const gchar*`

  File name to load or create the new cache.

  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

`source`

  Type: `ESource`

  An optional `ESource`, associated with the `EBookCache`, or `NULL`.

  The argument can be `NULL`.
  The data is owned by the caller of the function.

`cancellable`

  Type: `GCancellable`

  Optional `GCancellable` object, or `NULL`.

  The argument can be `NULL`.
  The data is owned by the caller of the function.

`error`

  Type: `GError **`

  The return location for a recoverable error.

  The argument can be `NULL`.
  If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`.
  The argument will be left initialized to `NULL` by the constructor if there are no errors.
  In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it.

#### Return value

Type: `EBookCache`

A new `EBookCache` or `NULL` on error.

The caller of the function takes ownership of the data, and is responsible for freeing it.
The return value can be `NULL`.