rediscache

package
v0.0.0-...-ab8551a Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRedisCache

func NewRedisCache(opt *redis.Options) (*redis.Client, error)

Types

type CinemaCache

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

func NewCinemaCache

func NewCinemaCache(logger *logrus.Logger,
	cinemasCitiesRdb,
	cinemasRdb,
	citiesRdb,
	hallsConfigurationsRdb,
	hallsRdb *redis.Client,
	metrics Metrics) *CinemaCache

func (*CinemaCache) CacheCinema

func (c *CinemaCache) CacheCinema(ctx context.Context, cinema models.Cinema, ttl time.Duration) (err error)

func (*CinemaCache) CacheCinemasCities

func (c *CinemaCache) CacheCinemasCities(ctx context.Context, cities []models.City, ttl time.Duration) (err error)

func (*CinemaCache) CacheCinemasInCity

func (c *CinemaCache) CacheCinemasInCity(ctx context.Context, id int32, cinemas []models.Cinema, ttl time.Duration) (err error)

func (*CinemaCache) CacheHallConfiguraion

func (c *CinemaCache) CacheHallConfiguraion(ctx context.Context, id int32, places []models.Place, ttl time.Duration) (err error)

func (*CinemaCache) CacheHalls

func (c *CinemaCache) CacheHalls(ctx context.Context, halls []models.Hall, ttl time.Duration) (err error)

func (*CinemaCache) GetCinema

func (c *CinemaCache) GetCinema(ctx context.Context, id int32) (cinema models.Cinema, err error)

func (*CinemaCache) GetCinemasCities

func (c *CinemaCache) GetCinemasCities(ctx context.Context) (cities []models.City, err error)

func (*CinemaCache) GetCinemasInCity

func (c *CinemaCache) GetCinemasInCity(ctx context.Context, cityID int32) (cinemas []models.Cinema, err error)

func (*CinemaCache) GetHallConfiguraion

func (c *CinemaCache) GetHallConfiguraion(ctx context.Context, id int32) (places []models.Place, err error)

func (*CinemaCache) GetHalls

func (c *CinemaCache) GetHalls(ctx context.Context, ids []int32) (halls []models.Hall, notFoundedIds []int32, err error)

func (*CinemaCache) PingContext

func (c *CinemaCache) PingContext(ctx context.Context) error

type Metrics

type Metrics interface {
	IncCacheHits(method string, times int)
	IncCacheMiss(method string, times int)
}

Jump to

Keyboard shortcuts

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