OpenBSD::IdCache(3p)

NAME
OpenBSD::IdCache - cache for user and group look-ups

SYNOPSIS
    use OpenBSD::IdCache;

    my $ucache = new OpenBSD::UidCache;
    my $uid = $ucache->lookup("espie");

    my $gcache = new OpenBSD::GidCache;
    my $gid = $gcache->lookup("wheel", 0);

    my $unamecache = new OpenBSD::UnameCache;
    my $name = $unamecache->lookup($uid);

    my $gnamecache = new OpenBSD::GnameCache;
    my $grname = $gnamecache->lookup($gid);

DESCRIPTION
"OpenBSD::IdCache" provides four classes: "OpenBSD::UidCache" for UIDs, "OpenBSD::GidCache" for GIDs, "OpenBSD::UnameCache" for user names, and "OpenBSD::GnameCache" for group names.

"UidCache::new" creates a UID cache, which can be used to look up user names by using the "lookup" method. Looking up a numeric user name is a no-op. Non-existing IDs return a default value, which is normally "undef" but can be provided as an extra argument to "lookup".

"GidCache::new" provides the same service for GIDs.

"UnameCache::new" creates a user name cache, which can be used to look up UIDs.

"GnameCache::new" provides the same service for group names.