folks Reference Manual | ||||
---|---|---|---|---|
Top | Description | Object Hierarchy | Properties |
#define FOLKS_TYPE_OBJECT_CACHE GVariantType * folks_object_cache_get_serialised_object_type (FolksObjectCache *self
,guint8 object_version
); guint8 folks_object_cache_get_serialised_object_version (FolksObjectCache *self
); GVariant * folks_object_cache_serialise_object (FolksObjectCache *self
,gconstpointer object
); gpointer folks_object_cache_deserialise_object (FolksObjectCache *self
,GVariant *variant
,guint8 object_version
); void folks_object_cache_load_objects (FolksObjectCache *self
,GCancellable *cancellable
,GAsyncReadyCallback _callback_
,gpointer _user_data_
); GeeSet * folks_object_cache_load_objects_finish (FolksObjectCache *self
,GAsyncResult *_res_
); void folks_object_cache_store_objects (FolksObjectCache *self
,GeeSet *objects
,GCancellable *cancellable
,GAsyncReadyCallback _callback_
,gpointer _user_data_
); void folks_object_cache_store_objects_finish (FolksObjectCache *self
,GAsyncResult *_res_
); void folks_object_cache_clear_cache (FolksObjectCache *self
,GAsyncReadyCallback _callback_
,gpointer _user_data_
); void folks_object_cache_clear_cache_finish (FolksObjectCache *self
,GAsyncResult *_res_
); const gchar * folks_object_cache_get_type_id (FolksObjectCache *self
); const gchar * folks_object_cache_get_id (FolksObjectCache *self
); struct FolksObjectCache;
"id" gchar* : Read / Write / Construct Only "t-destroy-func" gpointer : Write / Construct Only "t-dup-func" gpointer : Write / Construct Only "t-type" GType* : Write / Construct Only "type-id" gchar* : Read / Write / Construct Only
It's intended that this class be used for providing caching layers for FolksPersonaStores, for example.
#define FOLKS_TYPE_OBJECT_CACHE (folks_object_cache_get_type ())
The type for FolksObjectCache.
GVariantType * folks_object_cache_get_serialised_object_type (FolksObjectCache *self
,guint8 object_version
);
Get the GVariantType of the serialised form of an object stored in this cache.
If a smooth upgrade path is needed in future due to cache file format changes, this may be modified to take a version parameter.
|
the FolksObjectCache instance |
|
the version of the object format to use, or `uint8.MAX` for the latest version. [in] |
Returns : |
variant type for that object version, or `null` if the version is unsupported |
Since 0.6.0
guint8 folks_object_cache_get_serialised_object_version
(FolksObjectCache *self
);
Get the version of the variant type returned by
. This must be incremented every time the variant type changes so that old cache files aren't misinterpreted.
folks_object_cache_get_serialised_object_type()
|
the FolksObjectCache instance |
Since 0.6.0
GVariant * folks_object_cache_serialise_object (FolksObjectCache *self
,gconstpointer object
);
Serialise the given `object` to a GVariant and return the variant. The variant must be of the type returned by
.
folks_object_cache_get_serialised_object_type()
|
the FolksObjectCache instance |
|
the object to serialise. [in] |
Returns : |
serialised form of `object` |
Since 0.6.0
gpointer folks_object_cache_deserialise_object (FolksObjectCache *self
,GVariant *variant
,guint8 object_version
);
Deserialise the given `variant` to a new instance of an object. The variant is guaranteed to have the type returned by
.
folks_object_cache_get_serialised_object_type()
|
the FolksObjectCache instance |
|
the serialised form to deserialise. [in] |
|
the version of the object format to deserialise from. [in] |
Returns : |
the deserialised object |
Since 0.6.0
void folks_object_cache_load_objects (FolksObjectCache *self
,GCancellable *cancellable
,GAsyncReadyCallback _callback_
,gpointer _user_data_
);
Load a set of objects from the cache and return them as a new set. If the cache file doesn't exist, `null` will be returned. An empty set will be returned if the cache file existed but was empty (i.e. was stored with an empty set originally).
Loading the objects can be cancelled using `cancellable`. If it is, `null` will be returned.
If any errors are encountered while loading the objects, warnings will be logged as appropriate and `null` will be returned.
See also: folks_object_cache_load_objects_finish()
|
the FolksObjectCache instance |
|
A GCancellable for the operation, or `null`. [in][allow-none] |
|
callback to call when the request is satisfied. [scope async] |
|
the data to pass to _callback_ function. [closure]
|
Since 0.6.0
GeeSet * folks_object_cache_load_objects_finish (FolksObjectCache *self
,GAsyncResult *_res_
);
Load a set of objects from the cache and return them as a new set. If the cache file doesn't exist, `null` will be returned. An empty set will be returned if the cache file existed but was empty (i.e. was stored with an empty set originally).
Loading the objects can be cancelled using `cancellable`. If it is, `null` will be returned.
If any errors are encountered while loading the objects, warnings will be logged as appropriate and `null` will be returned.
See also: folks_object_cache_load_objects()
|
the FolksObjectCache instance |
|
a GAsyncResult |
Returns : |
A set of objects from the cache, or `null`. |
Since 0.6.0
void folks_object_cache_store_objects (FolksObjectCache *self
,GeeSet *objects
,GCancellable *cancellable
,GAsyncReadyCallback _callback_
,gpointer _user_data_
);
Store a set of objects to the cache file, overwriting any existing set of objects in the cache, or creating the cache file from scratch if it didn't previously exist.
Storing the objects can be cancelled using `cancellable`. If it is, the cache will be left in a consistent state, but may be storing the old set of objects or the new set.
See also: folks_object_cache_store_objects_finish()
|
the FolksObjectCache instance |
|
A set of objects to store. This may be empty, but may not be `null`. [in] |
|
A GCancellable for the operation, or `null`. [in][allow-none] |
|
callback to call when the request is satisfied. [scope async] |
|
the data to pass to _callback_ function. [closure]
|
Since 0.6.0
void folks_object_cache_store_objects_finish (FolksObjectCache *self
,GAsyncResult *_res_
);
Store a set of objects to the cache file, overwriting any existing set of objects in the cache, or creating the cache file from scratch if it didn't previously exist.
Storing the objects can be cancelled using `cancellable`. If it is, the cache will be left in a consistent state, but may be storing the old set of objects or the new set.
See also: folks_object_cache_store_objects()
|
the FolksObjectCache instance |
|
a GAsyncResult |
Since 0.6.0
void folks_object_cache_clear_cache (FolksObjectCache *self
,GAsyncReadyCallback _callback_
,gpointer _user_data_
);
Clear this cache object, deleting its backing file.
See also: folks_object_cache_clear_cache_finish()
|
the FolksObjectCache instance |
|
callback to call when the request is satisfied. [scope async] |
|
the data to pass to _callback_ function. [closure]
|
Since 0.6.0
void folks_object_cache_clear_cache_finish (FolksObjectCache *self
,GAsyncResult *_res_
);
Clear this cache object, deleting its backing file.
See also: folks_object_cache_clear_cache()
|
the FolksObjectCache instance |
|
a GAsyncResult |
Since 0.6.0
const gchar * folks_object_cache_get_type_id (FolksObjectCache *self
);
|
the FolksObjectCache instance to query |
Returns : |
the value of the "type-id" property |
const gchar * folks_object_cache_get_id (FolksObjectCache *self
);
|
the FolksObjectCache instance to query |
Returns : |
the value of the "id" property |
struct FolksObjectCache;
A generic abstract cache for sets of objects. This can be used by subclasses to implement caching of homogeneous sets of objects. Subclasses simply have to implement serialisation and deserialisation of the objects to and from GVariants.
It's intended that this class be used for providing caching layers for FolksPersonaStores, for example.
Since 0.6.0