GLib.Cache.new
Description: Reference for GLib.Cache.new

### Function

# GLib Cachenew

deprecated: 2.32

#### Declaration [src]

    GCache*
    g_cache_new (
      GCacheNewFunc value_new_func,
      GCacheDestroyFunc value_destroy_func,
      GCacheDupFunc key_dup_func,
      GCacheDestroyFunc key_destroy_func,
      GHashFunc hash_key_func,
      GHashFunc hash_value_func,
      GEqualFunc key_equal_func
    )

#### Description [src]

Creates a new `GCache`.

Deprecated since: 2.32

Use a `GHashTable` instead.

This function is not directly available to language bindings.

#### Parameters

`value_new_func`

  Type: `GCacheNewFunc`

  A function to create a new object given a key. This is called by `g_cache_insert()` if an object with the given key does not already exist.

`value_destroy_func`

  Type: `GCacheDestroyFunc`

  A function to destroy an object. It is called by `g_cache_remove()` when the object is no longer needed (i.e. its reference count drops to 0).

`key_dup_func`

  Type: `GCacheDupFunc`

  A function to copy a key. It is called by `g_cache_insert()` if the key does not already exist in the `GCache`.

`key_destroy_func`

  Type: `GCacheDestroyFunc`

  A function to destroy a key. It is called by `g_cache_remove()` when the object is no longer needed (i.e. its reference count drops to 0).

`hash_key_func`

  Type: `GHashFunc`

  A function to create a hash value from a key.

`hash_value_func`

  Type: `GHashFunc`

  A function to create a hash value from a value.

`key_equal_func`

  Type: `GEqualFunc`

  A function to compare two keys. It should return `TRUE` if the two keys are equivalent.

#### Return value

Type: `GCache`

A new `GCache`.

The data is owned by the called function.