Documentation ¶
Index ¶
Constants ¶
View Source
const (
PoliciesCacheTtlEnvVar = "POLICIES_CACHE_TTL"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PolicyHandler ¶
type PolicyHandler struct {
// contains filtered or unexported fields
}
PolicyHandler
func NewPolicyHandler ¶
func NewPolicyHandler(clusterName string) *PolicyHandler
NewPolicyHandler creates and returns an instance of the `PolicyHandler`. The function initializes the `PolicyHandler` only if it hasn't been previously created. The PolicyHandler supports caching of downloaded policies and exceptions by setting the `POLICIES_CACHE_TTL` environment variable (default is no caching).
func (*PolicyHandler) CollectPolicies ¶
func (policyHandler *PolicyHandler) CollectPolicies(ctx context.Context, policyIdentifier []cautils.PolicyIdentifier, scanInfo *cautils.ScanInfo) (*cautils.OPASessionObj, error)
type TimedCache ¶
type TimedCache[T any] struct { // contains filtered or unexported fields }
TimedCache provides functionality for managing a timed cache. The timed cache holds a value for a specified time duration (TTL). After the TTL has passed, the value is invalidated.
The cache is thread safe.
func NewTimedCache ¶
func NewTimedCache[T any](ttl time.Duration) *TimedCache[T]
func (*TimedCache[T]) Get ¶
func (c *TimedCache[T]) Get() (T, bool)
func (*TimedCache[T]) Invalidate ¶
func (c *TimedCache[T]) Invalidate()
func (*TimedCache[T]) Set ¶
func (c *TimedCache[T]) Set(value T)
func (*TimedCache[T]) Stop ¶ added in v3.0.3
func (c *TimedCache[T]) Stop()
Click to show internal directories.
Click to hide internal directories.