libpkgconf cache module

The libpkgconf cache module manages a package/module object cache, allowing it to avoid loading duplicate copies of a package/module.

A cache is tied to a specific pkgconf client object, so package objects should not be shared across threads.

pkgconf_pkg_t *pkgconf_cache_lookup(const pkgconf_client_t *client, const char *id)

Looks up a package in the cache given an id atom, such as gtk+-3.0 and returns the already loaded version if present.

Parameters:
  • client (pkgconf_client_t*) – The client object to access.
  • id (char*) – The package atom to look up in the client object’s cache.
Returns:

A package object if present, else NULL.

Return type:

pkgconf_pkg_t *

void pkgconf_cache_add(pkgconf_client_t *client, pkgconf_pkg_t *pkg)

Adds an entry for the package to the package cache. The cache entry must be removed if the package is freed.

Parameters:
  • client (pkgconf_client_t*) – The client object to modify.
  • pkg (pkgconf_pkg_t*) – The package object to add to the client object’s cache.
Returns:

nothing

void pkgconf_cache_remove(pkgconf_client_t *client, pkgconf_pkg_t *pkg)

Deletes a package from the client object’s package cache.

Parameters:
  • client (pkgconf_client_t*) – The client object to modify.
  • pkg (pkgconf_pkg_t*) – The package object to remove from the client object’s cache.
Returns:

nothing

void pkgconf_cache_free(pkgconf_client_t *client)

Releases all resources related to a client object’s package cache. This function should only be called to clear a client object’s package cache, as it may release any package in the cache.

Parameters:
  • client (pkgconf_client_t*) – The client object to modify.