NetgroupCache (Apache Hadoop Common 3.5.0 API)
Description: declaration: package: org.apache.hadoop.security, class: NetgroupCache

Package org.apache.hadoop.security

# Class NetgroupCache

java.lang.Object
org.apache.hadoop.security.NetgroupCache

@LimitedPrivate({"HDFS","MapReduce"}) @Unstable public class NetgroupCache extends Object
Class that caches the netgroups and inverts group-to-user map to user-to-group map, primarily intended for use with netgroups (as returned by getent netgrgoup) which only returns group to user mapping.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `NetgroupCache()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static void`
  `add(String group, List<String> users)`
  Add group to cache
  `static void`
  `clear()`
  Clear the cache
  `static List<String>`
  `getNetgroupNames()`
  Get the list of cached netgroups
  `static void`
  `getNetgroups(String user, List<String> groups)`
  Get netgroups for a given user
  `static boolean`
  `isCached(String group)`
  Returns true if a given netgroup is cached

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### NetgroupCache

    public NetgroupCache()

- ## Method Details

  - ### getNetgroups

    public static void getNetgroups(String user, List<String> groups)
    Get netgroups for a given user
    Parameters:
      `user` - get groups for this user
      `groups` - put groups into this List

  - ### getNetgroupNames

    public static List<String> getNetgroupNames()
    Get the list of cached netgroups
    Returns:
      list of cached groups

  - ### isCached

    public static boolean isCached(String group)
    Returns true if a given netgroup is cached
    Parameters:
      `group` - check if this group is cached
    Returns:
      true if group is cached, false otherwise

  - ### clear

    public static void clear()
    Clear the cache

  - ### add

    public static void add(String group, List<String> users)
    Add group to cache
    Parameters:
      `group` - name of the group to add to cache
      `users` - list of users for a given group