Top |
FolksObjectCacheFolksObjectCache — 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. |
#define | FOLKS_TYPE_OBJECT_CACHE |
void | folks_object_cache_load_objects () |
GeeSet * | folks_object_cache_load_objects_finish () |
void | folks_object_cache_store_objects () |
void | folks_object_cache_store_objects_finish () |
void | folks_object_cache_clear_cache () |
void | folks_object_cache_clear_cache_finish () |
const gchar * | folks_object_cache_get_type_id () |
const gchar * | folks_object_cache_get_id () |
gchar * | id | Read / Write / Construct Only |
gpointer | t-destroy-func | Write / Construct Only |
gpointer | t-dup-func | Write / Construct Only |
GType * | t-type | Write / Construct Only |
gchar * | type-id | 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.
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.
This method is safe to call multiple times concurrently.
See also: folks_object_cache_load_objects_finish()
self |
the FolksObjectCache instance |
|
cancellable |
. A GCancellable for the operation, or . |
[in][allow-none] |
_callback_ |
callback to call when the request is satisfied. |
[scope async] |
_user_data_ |
the data to pass to |
[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.
This method is safe to call multiple times concurrently.
See also: folks_object_cache_load_objects()
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.
This method is safe to call multiple times concurrently.
See also: folks_object_cache_store_objects_finish()
self |
the FolksObjectCache instance |
|
objects |
. A set of objects to store. This may be empty, but may not be . |
[in] |
cancellable |
. A GCancellable for the operation, or . |
[in][allow-none] |
_callback_ |
callback to call when the request is satisfied. |
[scope async] |
_user_data_ |
the data to pass to |
[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.
This method is safe to call multiple times concurrently.
See also: folks_object_cache_store_objects()
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()
self |
the FolksObjectCache instance |
|
_callback_ |
callback to call when the request is satisfied. |
[scope async] |
_user_data_ |
the data to pass to |
[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()
Since 0.6.0
const gchar *
folks_object_cache_get_type_id (FolksObjectCache *self
);
Get and return the current value of the "type-id" property.
A string identifying the type of object being cached.
This has to be suitable for use as a directory name; i.e. lower case, hyphen-separated tokens.
Since 0.6.6
const gchar *
folks_object_cache_get_id (FolksObjectCache *self
);
Get and return the current value of the "id" property.
A string identifying the particular cache instance.
This will form the file name of the cache file, but will be escaped beforehand, so can be an arbitrary non-empty string.
Since 0.6.6
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
struct FolksObjectCacheClass { GObjectClass parent_class; GVariantType* (*get_serialised_object_type) (FolksObjectCache* self, guint8 object_version); guint8 (*get_serialised_object_version) (FolksObjectCache* self); GVariant* (*serialise_object) (FolksObjectCache* self, gconstpointer object); gpointer (*deserialise_object) (FolksObjectCache* self, GVariant* variant, guint8 object_version); };
The class structure for FOLKS_TYPE_OBJECT_CACHE
. All the fields in this structure are private and should never be accessed directly.
GObjectClass |
the parent class structure |
|
virtual method used internally |
||
virtual method used internally |
||
virtual method used internally |
||
virtual method used internally |
“id”
property“id” gchar *
A string identifying the particular cache instance.
This will form the file name of the cache file, but will be escaped beforehand, so can be an arbitrary non-empty string.
Flags: Read / Write / Construct Only
Default value: NULL
Since 0.6.6
“type-id”
property“type-id” gchar *
A string identifying the type of object being cached.
This has to be suitable for use as a directory name; i.e. lower case, hyphen-separated tokens.
Flags: Read / Write / Construct Only
Default value: NULL
Since 0.6.6