1$OpenBSD: IdCache.pod,v 1.2 2023/05/16 11:20:00 espie Exp $
2
3=head1 NAME
4
5OpenBSD::IdCache - cache for user and group look-ups
6
7=head1 SYNOPSIS
8
9    use OpenBSD::IdCache;
10
11    my $ucache = OpenBSD::UidCache->new;
12    my $uid = $ucache->lookup("espie");
13
14    my $gcache = OpenBSD::GidCache->new;
15    my $gid = $gcache->lookup("wheel", 0);
16
17    my $unamecache = OpenBSD::UnameCache->new;
18    my $name = $unamecache->lookup($uid);
19
20    my $gnamecache = OpenBSD::GnameCache->new;
21    my $grname = $gnamecache->lookup($gid);
22
23=head1 DESCRIPTION
24
25C<OpenBSD::IdCache> provides four classes: C<OpenBSD::UidCache> for UIDs,
26C<OpenBSD::GidCache> for GIDs, C<OpenBSD::UnameCache> for user names, and
27C<OpenBSD::GnameCache> for group names.
28
29C<UidCache::new> creates a UID cache, which can be used to look up user
30names by using the C<lookup> method.  Looking up a numeric user name
31is a no-op. Non-existing IDs return a default value, which is normally
32C<undef> but can be provided as an extra argument to C<lookup>.
33
34C<GidCache::new> provides the same service for GIDs.
35
36C<UnameCache::new> creates a user name cache, which can be used to look up
37UIDs.
38
39C<GnameCache::new> provides the same service for group names.
40