token

package
v0.0.0-...-7fadfd3 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//DefaultExpiration never expire
	DefaultExpiration = 0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Get(token string) *TtyParameter
	Delete(token string) error
	Add(token string, param *TtyParameter, d time.Duration) error
}

interface that defines token cache behavior

type MemCache

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

MemCache use memory to store token and TtyParameter

func NewMemCache

func NewMemCache() *MemCache

NewMemCache new MemCache

func (*MemCache) Add

func (r *MemCache) Add(token string, param *TtyParameter, d time.Duration) error

Add token to memory

func (*MemCache) Delete

func (r *MemCache) Delete(token string) error

Delete token from memory

func (*MemCache) Get

func (r *MemCache) Get(token string) *TtyParameter

Get token param from memory

type RedisCache

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

RedisCache use redis to store token and TtyParameter

func NewRedisCache

func NewRedisCache(client *redis.Client, prefix string) *RedisCache

NewRedisCache new redis token cache

func (*RedisCache) Add

func (r *RedisCache) Add(token string, param *TtyParameter, d time.Duration) error

Add token to redis

func (*RedisCache) Delete

func (r *RedisCache) Delete(token string) error

Delete token from redis

func (*RedisCache) Get

func (r *RedisCache) Get(token string) *TtyParameter

Get token param from redis

type TtyParameter

type TtyParameter struct {
	Title string
	Arg   string
}

TtyParameter kubectl tty param

Jump to

Keyboard shortcuts

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