list() function is able to retrieve a list of objects from the kubernetes cluster either cached or directly.
list() takes parameters in the form of
list(Kind, apiVersion, ListOptions?).
If you call
list() within a policy, jsPolicy will by default try to get the resources from its internal cache to save time and ease pressure on the api server.
You do not need to configure in jsPolicy which resources are cached by jsPolicy as it will figure this out automatically by tracking which resources are called in get() and list().
If resources are not needed anymore in the cache (after no
list() has been called for a specific time), jsPolicy will delete its internal cache for that resource automatically.
You can explicitly tell jsPolicy to make a direct call to the api server instead of retrieving the resources from the cache via the get or list options.