Class (GI Struct)

GLib-2.0GLibCacheAbstractDeprecated 2.32

A GLib.Cache allows sharing of complex data structures, in order to save system resources.

GLib.Cache uses keys and values. A GLib.Cache key describes the properties of a particular resource. A GLib.Cache value is the actual resource.

GLib.Cache has been marked as deprecated, since this API is rarely used and not very actively maintained.

since 2.32: Use a GLib.HashTable instead

Index

Constructors

Properties

$gtype: GType<GLib.Cache>

Methods

  • Gets the value corresponding to the given key, creating it if necessary. It first checks if the value already exists in the GLib.Cache, 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 GLib.Cache.

    Parameters

    • OptionalDeprecatedkey: any

      a key describing a GLib.Cache object

    Returns any

    a pointer to a GLib.Cache value

  • Calls the given function for each of the keys in the GLib.Cache.

    NOTE func is passed three parameters, the value and key of a cache entry and the user_data. The order of value and key is different from the order in which g_hash_table_foreach() passes key-value pairs to its callback function !

    Parameters

    Returns void

  • Decreases the reference count of the given value. If it drops to 0 then the value and its corresponding key are destroyed, using the value_destroy_func and key_destroy_func passed to g_cache_new().

    Parameters

    • OptionalDeprecatedvalue: any

      the value to remove

    Returns void