GObject.type_add_class_cache_func
Description: Reference for GObject.type_add_class_cache_func

### Function

# GObjecttype_add_class_cache_func

since: 2.0

#### Declaration

    void
    g_type_add_class_cache_func (
      gpointer cache_data,
      GTypeClassCacheFunc cache_func
    )

#### Description

Adds a `GTypeClassCacheFunc` to be called before the reference count of a class goes from one to zero. This can be used to prevent premature class destruction. All installed `GTypeClassCacheFunc` functions will be chained until one of them returns `TRUE`. The functions have to check the class id passed in to figure whether they actually want to cache the class of this type, since all classes are routed through the same `GTypeClassCacheFunc` chain.

Available since: 2.0

This function is not directly available to language bindings.

#### Parameters

`cache_data`

  Type: `gpointer`

  Data to be passed to `cache_func`.

  The argument can be `NULL`.
  The data is owned by the caller of the function.

`cache_func`

  Type: `GTypeClassCacheFunc`

  A `GTypeClassCacheFunc`.