summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD/IdCache.pod
blob: e024130f22b82140e0eeb924def168f160fbc252 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
$OpenBSD: IdCache.pod,v 1.1 2020/12/20 15:30:58 daniel Exp $

=head1 NAME

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

=head1 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);

=head1 DESCRIPTION

C<OpenBSD::IdCache> provides four classes: C<OpenBSD::UidCache> for UIDs,
C<OpenBSD::GidCache> for GIDs, C<OpenBSD::UnameCache> for user names, and
C<OpenBSD::GnameCache> for group names.

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

C<GidCache::new> provides the same service for GIDs.

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

C<GnameCache::new> provides the same service for group names.