admincache

package
v1.11.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2022 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Overview

Package admin cache caches admin credentials

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache caches admin credentials

func New

func New(maxDuration time.Duration) *Cache

New creates a new cache that expires entries older than maxDuration.

func (*Cache) Get

func (c *Cache) Get(user string) (isAdmin, valid bool)

Get returns cached admin credentials for given user. isAdmin is true if user has admin credentials. valid is true if cache entry for user has not expired. Initially, Get returns false, false for all users. If c is nil, Get always returns false, false

func (*Cache) Put

func (c *Cache) Put(user string, isAdmin bool)

Put replaces admin credentials for given user. Admin credentials for user will remain valid for maxDuration time. If c is nil, Put is a no-op.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL