Method

CamelDataCacheadd_atomic

unstable since: 3.62

Declaration [src]

GIOStream*
camel_data_cache_add_atomic (
  CamelDataCache* cdc,
  const gchar* path,
  const gchar* key,
  GError** error
)

Description [src]

Open a temporary file for writing a new cache item identified by path and key. The temporary file lives in the same directory as the final target so that camel_data_cache_commit_atomic() can rename it into place atomically (same-filesystem rename).

Any concurrent call to camel_data_cache_get() for the same path/key will block until the caller either commits or discards the stream.

On success, pass the returned stream to camel_data_cache_commit_atomic() or camel_data_cache_discard_atomic(); the stream is consumed (transfer full) by both functions. Do not call g_object_unref() on it directly.

Available since: 3.62

Parameters

path

Type: const gchar*

Relative path of item to add.

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

Type: const gchar*

Key of item to add.

The data is owned by the caller of the method.
The value is a NUL terminated UTF-8 string.
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 method 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: GIOStream

A GIOStream for writing, or NULL on error.

The caller of the method takes ownership of the returned data, and is responsible for freeing it.