GLib.Cache.insert

### Method

# GLib Cacheinsert

deprecated: 2.32

#### Declaration

    gpointer
    g_cache_insert (
      GCache* cache,
      gpointer key
    )

#### Description

Gets the value corresponding to the given key, creating it if necessary. It first checks if the value already exists in the `GCache`, by using the `key_equal_func` function passed to g_cache_new(). If it does already exist it is returned, and its reference count is increased by one. If the value does not currently exist, if is created by calling the `value_new_func`. The key is duplicated by calling `key_dup_func` and the duplicated key and value are inserted into the `GCache`.

Deprecated since: 2.32

Use a `GHashTable` instead.

#### Parameters

`key`

  Type: `gpointer`

  A key describing a `GCache` object.

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

#### Return value

Type: `gpointer`

A pointer to a `GCache` value.

The data is owned by the instance.
The return value can be `NULL`.