xref: /freebsd/contrib/pkgconf/doc/libpkgconf-cache.rst (revision a3cefe7f2b4df0f70ff92d4570ce18e517af43ec)
1
2libpkgconf `cache` module
3=========================
4
5The libpkgconf `cache` module manages a package/module object cache, allowing it to
6avoid loading duplicate copies of a package/module.
7
8A cache is tied to a specific pkgconf client object, so package objects should not
9be shared across threads.
10
11.. c:function:: pkgconf_pkg_t *pkgconf_cache_lookup(const pkgconf_client_t *client, const char *id)
12
13   Looks up a package in the cache given an `id` atom,
14   such as ``gtk+-3.0`` and returns the already loaded version
15   if present.
16
17   :param pkgconf_client_t* client: The client object to access.
18   :param char* id: The package atom to look up in the client object's cache.
19   :return: A package object if present, else ``NULL``.
20   :rtype: pkgconf_pkg_t *
21
22.. c:function:: void pkgconf_cache_add(pkgconf_client_t *client, pkgconf_pkg_t *pkg)
23
24   Adds an entry for the package to the package cache.
25   The cache entry must be removed if the package is freed.
26
27   :param pkgconf_client_t* client: The client object to modify.
28   :param pkgconf_pkg_t* pkg: The package object to add to the client object's cache.
29   :return: nothing
30
31.. c:function:: void pkgconf_cache_remove(pkgconf_client_t *client, pkgconf_pkg_t *pkg)
32
33   Deletes a package from the client object's package cache.
34
35   :param pkgconf_client_t* client: The client object to modify.
36   :param pkgconf_pkg_t* pkg: The package object to remove from the client object's cache.
37   :return: nothing
38
39.. c:function:: void pkgconf_cache_free(pkgconf_client_t *client)
40
41   Releases all resources related to a client object's package cache.
42   This function should only be called to clear a client object's package cache,
43   as it may release any package in the cache.
44
45   :param pkgconf_client_t* client: The client object to modify.
46