EBackend.Cache
Description: Reference for EBackend.Cache

### Class

# EBackendCache

since: 3.26

#### Description [src]

    abstract class EBackend.Cache : GObject.Object
    {
      /* No available fields */
    }

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

Available since: 3.26

#### Hierarchy

#### Ancestors

- GObject

#### Functions

###### e_cache_error_quark

No description available.

###### e_cache_sqlite_stmt_append_printf

Appends an SQLite statement fragment based on the `format` and its arguments to the `stmt`. The `format` can contain any values recognized by sqlite3_mprintf().

since: 3.26

###### e_cache_sqlite_stmt_free

Frees a statement previously constructed with e_cache_sqlite_stmt_printf().

since: 3.26

###### e_cache_sqlite_stmt_printf

Creates an SQLite statement based on the `format` and its arguments. The `format` can contain any values recognized by sqlite3_mprintf().

since: 3.26

#### Instance methods

###### e_cache_change_revision

Instructs the `cache` to change its revision. In case the revision change is frozen with `e_cache_freeze_revision_change()` it notes to change the revision once the revision change is fully thaw.

since: 3.26

###### e_cache_clear_offline_changes

Marks all objects as being fully synchronized with the server and removes those which are marked as locally deleted.

since: 3.26

###### e_cache_contains

Checkes whether the `cache` contains an object with the given `uid`.

since: 3.26

###### e_cache_copy_missing_to_column_values

Adds every column value which is not part of the `other_columns` to it, except of E_CACHE_COLUMN_UID, E_CACHE_COLUMN_REVISION, E_CACHE_COLUMN_OBJECT and E_CACHE_COLUMN_STATE columns.

since: 3.32

###### e_cache_dup_key

No description available.

since: 3.26

###### e_cache_dup_revision

No description available.

since: 3.26

###### e_cache_erase

Erases the cache and all of its content from the disk. The only valid operation after this is to free the `cache`.

since: 3.26

###### e_cache_foreach

Calls `func` for each found object, which satisfies the criteria for both `deleted_flag` and `where_clause`.

since: 3.26

###### e_cache_foreach_update

Calls `func` for each found object, which satisfies the criteria for both `deleted_flag` and `where_clause`, letting the caller update values where necessary. The return value of `func` is used to determine whether the call was successful, not whether there are any changes to be saved. If anything fails during the call then the all changes are reverted.

since: 3.26

###### e_cache_freeze_revision_change

Freezes automatic revision change for the `cache`. The function can be called multiple times, but each such call requires its pair function `e_cache_thaw_revision_change()` call. See also e_cache_change_revision().

since: 3.26

###### e_cache_get

Returns an object with the given `uid`. This function does not consider locally deleted objects. The `out_revision` is set to the object revision, if not `NULL`. Free it with `g_free()` when no longer needed. Similarly the `out_other_columns` contains a column name to column value strings for additional columns which had been requested when calling e_cache_initialize_sync(), if not `NULL`. Free the returned `ECacheColumnValues` with e_cache_column_values_free(), when no longer needed.

since: 3.26

###### e_cache_get_count

No description available.

since: 3.26

###### e_cache_get_filename

No description available.

since: 3.26

###### e_cache_get_key_int

Reads the user `key` value as an integer.

since: 3.26

###### e_cache_get_object_include_deleted

The same as e_cache_get(), only considers also locally deleted objects.

since: 3.30

###### e_cache_get_objects

Gets a list of objects stored in the `cache`, optionally together with their revisions. The uids are not returned in any particular order, but the position between `out_objects` and `out_revisions` matches the same object.

since: 3.26

###### e_cache_get_offline_changes

Gathers the list of all offline changes being done so far. The returned `GSList` contains `ECacheOfflineChange` structure. Use `e_cache_clear_offline_changes()` to clear all offline changes at once.

since: 3.26

###### e_cache_get_offline_state

No description available.

since: 3.26

###### e_cache_get_sqlitedb

No description available.

since: 3.26

###### e_cache_get_uids

Gets a list of unique object identifiers stored in the `cache`, optionally together with their revisions. The uids are not returned in any particular order, but the position between `out_uids` and `out_revisions` matches the same object.

since: 3.26

###### e_cache_get_version

No description available.

since: 3.26

###### e_cache_initialize_sync

Initializes the `cache` and opens the `filename` database. This should be called by the descendant.

since: 3.26

###### e_cache_is_revision_change_frozen

No description available.

since: 3.26

###### e_cache_lock

Locks the `cache` thus other threads cannot use it. This can be called recursively within one thread. Each call should have its pair e_cache_unlock().

since: 3.26

###### e_cache_put

Stores an object into the cache. Depending on `offline_flag`, this update the object’s offline state accordingly. When the `offline_flag` is set to `E_CACHE_IS_ONLINE`, then it’s set to #E_OFFLINE_STATE_SYNCED, like to be fully synchronized with the server, regardless of its previous offline state. Overwriting locally deleted object behaves like an addition of a completely new object.

since: 3.26

###### e_cache_remove

Removes the object with the given `uid` from the `cache`. Based on the `offline_flag`, it can remove also any information about locally made offline changes. Removing the object with `E_CACHE_IS_OFFLINE` will still remember it for later use with e_cache_get_offline_changes().

since: 3.26

###### e_cache_remove_all

Removes all objects from the `cache` in one call.

since: 3.26

###### e_cache_set_key

Sets a `value` of the user `key`, or deletes it, if the `value` is `NULL`.

since: 3.26

###### e_cache_set_key_int

Sets an integer `value` for the user `key`.

since: 3.26

###### e_cache_set_offline_state

Sets an offline `state` for the object identified by `uid`.

since: 3.26

###### e_cache_set_revision

Sets the `revision` of the whole `cache`. This is not meant to be used by the descendants, because the revision is updated automatically when needed. The descendants can listen to “revision-changed” signal.

since: 3.26

###### e_cache_set_version

Sets a cache data version. This is meant to be used by the descendants. The `version` should be greater than zero.

since: 3.26

###### e_cache_sqlite_exec

Executes an SQLite statement. Use `e_cache_sqlite_select()` for SELECT statements.

since: 3.26

###### e_cache_sqlite_maybe_vacuum

Runs vacuum (compacts the database file), if needed.

since: 3.26

###### e_cache_sqlite_select

Executes a SELECT statement `sql_stmt` and calls `func` for each row of the result. Use `e_cache_sqlite_exec()` for statements which do not return row sets.

since: 3.26

###### e_cache_thaw_revision_change

Thaws automatic revision change for the `cache`. It’s the pair function of e_cache_freeze_revision_change().

since: 3.26

###### e_cache_unlock

Unlocks the cache which was previouly locked with e_cache_lock(). The cache locked with #E_CACHE_LOCK_WRITE should use either `action` #E_CACHE_UNLOCK_COMMIT or #E_CACHE_UNLOCK_ROLLBACK, while the #E_CACHE_LOCK_READ should use #E_CACHE_UNLOCK_NONE `action`.

since: 3.26

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

#### Signals

###### EBackend.Cache::before-put

No description available.

###### EBackend.Cache::before-remove

No description available.

###### EBackend.Cache::revision-changed

No description available.

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

#### Class structure

    struct EBackendCacheClass {
      gboolean (* put_locked) (
        ECache* cache,
        const gchar* uid,
        const gchar* revision,
        const gchar* object,
        ECacheColumnValues* other_columns,
        EOfflineState offline_state,
        gboolean is_replace,
        GCancellable* cancellable,
        GError** error
      );
      gboolean (* remove_locked) (
        ECache* cache,
        const gchar* uid,
        GCancellable* cancellable,
        GError** error
      );
      gboolean (* remove_all_locked) (
        ECache* cache,
        const GSList* uids,
        GCancellable* cancellable,
        GError** error
      );
      gboolean (* clear_offline_changes_locked) (
        ECache* cache,
        GCancellable* cancellable,
        GError** error
      );
      void (* erase) (
        ECache* cache
      );
      gboolean (* before_put) (
        ECache* cache,
        const gchar* uid,
        const gchar* revision,
        const gchar* object,
        ECacheColumnValues* other_columns,
        gboolean is_replace,
        GCancellable* cancellable,
        GError** error
      );
      gboolean (* before_remove) (
        ECache* cache,
        const gchar* uid,
        GCancellable* cancellable,
        GError** error
      );
      void (* revision_changed) (
        ECache* cache
      );

    }

No description available.

###### Class members

`put_locked: gboolean (* put_locked) ( ECache* cache, const gchar* uid, const gchar* revision, const gchar* object, ECacheColumnValues* other_columns, EOfflineState offline_state, gboolean is_replace, GCancellable* cancellable, GError** error )`

  No description available.

`remove_locked: gboolean (* remove_locked) ( ECache* cache, const gchar* uid, GCancellable* cancellable, GError** error )`

  No description available.

`remove_all_locked: gboolean (* remove_all_locked) ( ECache* cache, const GSList* uids, GCancellable* cancellable, GError** error )`

  No description available.

`clear_offline_changes_locked: gboolean (* clear_offline_changes_locked) ( ECache* cache, GCancellable* cancellable, GError** error )`

  No description available.

`erase: void (* erase) ( ECache* cache )`

  No description available.

`before_put: gboolean (* before_put) ( ECache* cache, const gchar* uid, const gchar* revision, const gchar* object, ECacheColumnValues* other_columns, gboolean is_replace, GCancellable* cancellable, GError** error )`

  No description available.

`before_remove: gboolean (* before_remove) ( ECache* cache, const gchar* uid, GCancellable* cancellable, GError** error )`

  No description available.

`revision_changed: void (* revision_changed) ( ECache* cache )`

  No description available.

#### Virtual methods

###### EBackend.CacheClass.before_put

No description available.

###### EBackend.CacheClass.before_remove

No description available.

###### EBackend.CacheClass.clear_offline_changes_locked

No description available.

###### EBackend.CacheClass.erase

Erases the cache and all of its content from the disk. The only valid operation after this is to free the `cache`.

since: 3.26

###### EBackend.CacheClass.put_locked

No description available.

###### EBackend.CacheClass.remove_all_locked

No description available.

###### EBackend.CacheClass.remove_locked

No description available.

###### EBackend.CacheClass.revision_changed

No description available.