cache

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientInterface

type ClientInterface interface {
	GetUser(ctx context.Context, s string) (models.User, bool, error)
	SetUser(ctx context.Context, s string, u models.User) error
	GetGroup(ctx context.Context, s string) (models.Group, bool, error)
	SetGroup(ctx context.Context, s string, g models.Group) error
}

ClientInterface ...

func NewCache

func NewCache(ctx context.Context, cacheEngine models.CacheEngine, config config.Config) (ClientInterface, error)

NewCache ...

type MemoryCache

type MemoryCache struct {
	CacheClient *gocache.Cache
}

MemoryCache ...

func NewMemoryCache

func NewMemoryCache(defaultExpiration, cleanupInterval time.Duration) (*MemoryCache, error)

NewMemoryCache ...

func (*MemoryCache) GetGroup

func (c *MemoryCache) GetGroup(ctx context.Context, s string) (models.Group, bool, error)

GetGroup ...

func (*MemoryCache) GetUser

func (c *MemoryCache) GetUser(ctx context.Context, s string) (models.User, bool, error)

GetUser ...

func (*MemoryCache) SetGroup

func (c *MemoryCache) SetGroup(ctx context.Context, s string, g models.Group) error

SetGroup ...

func (*MemoryCache) SetUser

func (c *MemoryCache) SetUser(ctx context.Context, s string, u models.User) error

SetUser ...

type RedisCache

type RedisCache struct {
	CacheClient *redis.Client
	Expiration  time.Duration
}

RedisCache ...

func NewRedisCache

func NewRedisCache(ctx context.Context, redisURL string, expiration time.Duration) (*RedisCache, error)

NewRedisCache ...

func (*RedisCache) GetGroup

func (c *RedisCache) GetGroup(ctx context.Context, s string) (models.Group, bool, error)

GetGroup ...

func (*RedisCache) GetUser

func (c *RedisCache) GetUser(ctx context.Context, s string) (models.User, bool, error)

GetUser ...

func (*RedisCache) SetGroup

func (c *RedisCache) SetGroup(ctx context.Context, s string, g models.Group) error

SetGroup ...

func (*RedisCache) SetUser

func (c *RedisCache) SetUser(ctx context.Context, s string, u models.User) error

SetUser ...

Jump to

Keyboard shortcuts

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