Folks.ObjectCache – folks Reference Manual

# ObjectCache

## Object Hierarchy:

## Description:

public abstract class ObjectCache<T> : Object

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 GLib.Variants.

It's intended that this class be used for providing caching layers for PersonaStores, for example.

## Since:

0.6.0

Namespace: Folks
Package: folks

## Content:

### Properties:

- public string id { get; construct; }
  A string identifying the particular cache instance.
- public string type_id { get; construct; }
  A string identifying the type of object being cached.

### Methods:

- public async void clear_cache ()
  Clear this cache object, deleting its backing file.
- public async Set<T>? load_objects (Cancellable? cancellable = null)
  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).
- public async void store_objects (Set<T> objects, Cancellable? cancellable = null)
  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.

### Inherited Members:

All known members inherited from class GLib.Object

- @get
- @new
- @ref
- @set
- add_toggle_ref
- add_weak_pointer
- bind_property
- connect
- constructed
- disconnect
- dispose
- dup_data
- dup_qdata
- force_floating
- freeze_notify
- get_class
- get_data

- get_property
- get_qdata
- get_type
- getv
- interface_find_property
- interface_install_property
- interface_list_properties
- is_floating
- new_valist
- new_with_properties
- newv
- notify
- notify_property
- ref_count
- ref_sink
- remove_toggle_ref
- remove_weak_pointer

- replace_data
- replace_qdata
- set_data
- set_data_full
- set_property
- set_qdata
- set_qdata_full
- set_valist
- setv
- steal_data
- steal_qdata
- thaw_notify
- unref
- watch_closure
- weak_ref
- weak_unref