cache

package
v0.0.0-...-bf57613 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorConnecting   = errors.New("unable to connect to the database")
	ErrorJsonEncoding = errors.New("json encoding error")
	ErrorJsonParsing  = errors.New("json parsing error")
	ErrorNewsNotFound = errors.New("news not found")
)

Functions

This section is empty.

Types

type LRUCache

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

func NewLRUCache

func NewLRUCache(maxSize int, expiration int) *LRUCache

func (*LRUCache) GetNews

func (c *LRUCache) GetNews(key string) interface{}

func (*LRUCache) SetNews

func (c *LRUCache) SetNews(key string, value interface{})

func (*LRUCache) StopTimer

func (c *LRUCache) StopTimer()

type RedisClient

type RedisClient struct {
	*redis.Client
}

func NewRedisClient

func NewRedisClient(config *redis.Options) *RedisClient

func (*RedisClient) GetNews

func (c *RedisClient) GetNews(ctx context.Context, key string) ([]cybernews.News, error)

func (*RedisClient) Health

func (client *RedisClient) Health() error

func (*RedisClient) SetNews

func (c *RedisClient) SetNews(ctx context.Context, key string, value []cybernews.News) error

Jump to

Keyboard shortcuts

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