caching

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MEMORY_CACHE_TYPE = "Memory"
	REDIS_CACHE_TYPE  = "Redis"
)

Variables

View Source
var Err_KEY_NOT_FOUND = fmt.Errorf("key not found")

Functions

This section is empty.

Types

type Cache deprecated

type Cache interface {
	Get(key string) (interface{}, error)
	Set(key string, value interface{}) error
	SetWithExpiration(key string, value interface{}, expiration time.Duration) error
	GetCtx(ctx context.Context, key string) (interface{}, error)
	SetCtx(ctx context.Context, key string, value interface{}) error
	SetWithExpirationCtx(
		ctx context.Context,
		key string,
		value interface{},
		expiration time.Duration,
	) error
	Delete(key string) error
	DeleteCtx(ctx context.Context, key string) error
	Keys(pattern string) ([]string, error)
	KeysCtx(ctx context.Context, pattern string) ([]string, error)
	WithLogger(l *zap.Logger) Cache
	WithTracer(t *tracer.AppInsightsCore) Cache
	WithName(name string) Cache
}

Deprecated: will be retired soon

func InitMemoryCache deprecated

func InitMemoryCache(
	expiration time.Duration,
	cleanupInterval time.Duration,
) Cache

Deprecated: will be retired soon InitMemoryCache initializes cache with in-memory type params:

  • expiration: expiration time
  • cleanupInterval: cleanup interval

returns:

  • Cache: cache instance

func InitRedisCache deprecated

func InitRedisCache(
	url string,
) (Cache, error)

Deprecated: will be retired soon InitRedisCache initializes cache with redis type params:

  • url: redis url

returns:

  • Cache: cache instance
  • error: error if any

Jump to

Keyboard shortcuts

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