cache

package
v0.0.0-...-b8dc01b Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TABLE_CACHE        = "cache"
	FAMILY_TEN_MINUTES = "10_min"
	FAMILY_ONE_HOUR    = "1_hour"
	FAMILY_ONE_DAY     = "1_day"
	COLUMN_DATA        = "d"
)

Variables

View Source
var TieredCache *tieredCache

Functions

func MustInitTieredCache

func MustInitTieredCache(redisAddress string)

func MustInitTieredCacheBigtable

func MustInitTieredCacheBigtable(client *gcp_bigtable.Client, chainId string)

Types

type BigtableCache

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

func InitBigtableCache

func InitBigtableCache(client *gcp_bigtable.Client, chainId string) *BigtableCache

func (*BigtableCache) Get

func (cache *BigtableCache) Get(ctx context.Context, key string, returnValue any) (any, error)

func (*BigtableCache) GetBool

func (cache *BigtableCache) GetBool(ctx context.Context, key string) (bool, error)

func (*BigtableCache) GetString

func (cache *BigtableCache) GetString(ctx context.Context, key string) (string, error)

func (*BigtableCache) GetUint64

func (cache *BigtableCache) GetUint64(ctx context.Context, key string) (uint64, error)

func (*BigtableCache) Set

func (cache *BigtableCache) Set(ctx context.Context, key string, value any, expiration time.Duration) error

func (*BigtableCache) SetBool

func (cache *BigtableCache) SetBool(ctx context.Context, key string, value bool, expiration time.Duration) error

func (*BigtableCache) SetString

func (cache *BigtableCache) SetString(ctx context.Context, key, value string, expiration time.Duration) error

func (*BigtableCache) SetUint64

func (cache *BigtableCache) SetUint64(ctx context.Context, key string, value uint64, expiration time.Duration) error

type RedisCache

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

func InitRedisCache

func InitRedisCache(ctx context.Context, redisAddress string) (*RedisCache, error)

func (*RedisCache) Get

func (cache *RedisCache) Get(ctx context.Context, key string, returnValue interface{}) (interface{}, error)

func (*RedisCache) GetBool

func (cache *RedisCache) GetBool(ctx context.Context, key string) (bool, error)

func (*RedisCache) GetString

func (cache *RedisCache) GetString(ctx context.Context, key string) (string, error)

func (*RedisCache) GetUint64

func (cache *RedisCache) GetUint64(ctx context.Context, key string) (uint64, error)

func (*RedisCache) Set

func (cache *RedisCache) Set(ctx context.Context, key string, value interface{}, expiration time.Duration) error

func (*RedisCache) SetBool

func (cache *RedisCache) SetBool(ctx context.Context, key string, value bool, expiration time.Duration) error

func (*RedisCache) SetString

func (cache *RedisCache) SetString(ctx context.Context, key, value string, expiration time.Duration) error

func (*RedisCache) SetUint64

func (cache *RedisCache) SetUint64(ctx context.Context, key string, value uint64, expiration time.Duration) error

type RemoteCache

type RemoteCache interface {
	Set(ctx context.Context, key string, value any, expiration time.Duration) error
	SetString(ctx context.Context, key, value string, expiration time.Duration) error
	SetUint64(ctx context.Context, key string, value uint64, expiration time.Duration) error
	SetBool(ctx context.Context, key string, value bool, expiration time.Duration) error

	Get(ctx context.Context, key string, returnValue any) (any, error)
	GetString(ctx context.Context, key string) (string, error)
	GetUint64(ctx context.Context, key string) (uint64, error)
	GetBool(ctx context.Context, key string) (bool, error)
}

Jump to

Keyboard shortcuts

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