with-group-cache ( quot -- ) (original) (raw)

with-group-cache ( quot -- )

Vocabulary
unix.groups

Inputs

quot a quotation

Outputs
None

Word description
Iterates over the group file using library calls and creates a cache in the group-cache symbol. The cache is a hashtable indexed by group id. When looking up many groups, this approach is much faster than calling system calls.

Definition

USING: kernel namespaces ;

IN: unix.groups

: with-group-cache ( quot -- )
[ group-cache ] dip with-variable ; inline