cache

package
v0.0.0-...-19239a5 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: EUPL-1.2 Imports: 7 Imported by: 0

Documentation

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
}

func NewRedis

func NewRedis(cacheConfig Configuration) *Cache

func (*Cache) DeleteDraft

func (r *Cache) DeleteDraft(ctx goContext.Context, draftId string) error

func (*Cache) FlushAll

func (r *Cache) FlushAll(ctx goContext.Context) error

func (*Cache) GetDraft

func (r *Cache) GetDraft(ctx goContext.Context, draftId string) (string, error)

func (*Cache) GetDrafts

func (r *Cache) GetDrafts(ctx goContext.Context) (map[string]string, error)

func (*Cache) GetUserId

func (r *Cache) GetUserId(ctx goContext.Context, token string) (int, error)

func (*Cache) IncrementTestInvoiceCounter

func (r *Cache) IncrementTestInvoiceCounter(ctx goContext.Context, userId int) (int, error)

Increments test invoice counter for user and returns it's new value. If counter doesn't exist new counter is created with value 1 and expiration 24 hours.

func (*Cache) RemoveUserToken

func (r *Cache) RemoveUserToken(ctx goContext.Context, token string) error

func (*Cache) SaveDraft

func (r *Cache) SaveDraft(ctx goContext.Context, draftId, name string) error

func (*Cache) SaveJti

func (r *Cache) SaveJti(ctx goContext.Context, userId int, jti string, expiration time.Duration) error

func (*Cache) SaveUserToken

func (r *Cache) SaveUserToken(ctx goContext.Context, token string, userId int) error

type Configuration

type Configuration struct {
	Host                             string
	Port                             int
	Password                         string
	SessionTokenExpiration           time.Duration
	TestInvoiceRateLimiterExpiration time.Duration
	TestInvoiceRateLimiterThreshold  int
}

func NewConfig

func NewConfig(defaultConfig Configuration) Configuration

type JtiExistsError

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

func (*JtiExistsError) Error

func (e *JtiExistsError) Error() string

type NotFoundError

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

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Jump to

Keyboard shortcuts

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