cache

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AfterCreate

func AfterCreate(cache *Gorm2Cache) func(db *gorm.DB)

func AfterDelete

func AfterDelete(cache *Gorm2Cache) func(db *gorm.DB)

func AfterQuery

func AfterQuery(cache *Gorm2Cache) func(db *gorm.DB)

func AfterUpdate

func AfterUpdate(cache *Gorm2Cache) func(db *gorm.DB)

func BeforeQuery

func BeforeQuery(cache *Gorm2Cache) func(db *gorm.DB)

func NewRedisConfigWithClient

func NewRedisConfigWithClient(client *redis.Client) *config.RedisConfig

func NewRedisConfigWithOptions

func NewRedisConfigWithOptions(options *redis.Options) *config.RedisConfig

Types

type Gorm2Cache

type Gorm2Cache struct {
	Config     *config.CacheConfig
	Logger     config.LoggerInterface
	InstanceId string
	// contains filtered or unexported fields
}

func NewGorm2Cache

func NewGorm2Cache(cacheConfig *config.CacheConfig) (*Gorm2Cache, error)

func (*Gorm2Cache) AttachToDB

func (c *Gorm2Cache) AttachToDB(db *gorm.DB)

func (*Gorm2Cache) BatchGetPrimaryCache

func (c *Gorm2Cache) BatchGetPrimaryCache(ctx context.Context, tableName string, primaryKeys []string) ([]string, error)

func (*Gorm2Cache) BatchInvalidatePrimaryCache

func (c *Gorm2Cache) BatchInvalidatePrimaryCache(ctx context.Context, tableName string, primaryKeys []string) error

func (*Gorm2Cache) BatchPrimaryKeyExists

func (c *Gorm2Cache) BatchPrimaryKeyExists(ctx context.Context, tableName string, primaryKeys []string) (bool, error)

func (*Gorm2Cache) BatchSetPrimaryKeyCache

func (c *Gorm2Cache) BatchSetPrimaryKeyCache(ctx context.Context, tableName string, kvs []util.Kv) error

func (*Gorm2Cache) GetHitCount

func (c *Gorm2Cache) GetHitCount() int64

func (*Gorm2Cache) GetSearchCache

func (c *Gorm2Cache) GetSearchCache(ctx context.Context, tableName string, sql string, vars ...any) (string, error)

func (*Gorm2Cache) IncrHitCount

func (c *Gorm2Cache) IncrHitCount()

func (*Gorm2Cache) Init

func (c *Gorm2Cache) Init() error

func (*Gorm2Cache) Initialize

func (c *Gorm2Cache) Initialize(db *gorm.DB) (err error)

func (*Gorm2Cache) InvalidateAllPrimaryCache

func (c *Gorm2Cache) InvalidateAllPrimaryCache(ctx context.Context, tableName string) error

func (*Gorm2Cache) InvalidatePrimaryCache

func (c *Gorm2Cache) InvalidatePrimaryCache(ctx context.Context, tableName string, primaryKey string) error

func (*Gorm2Cache) InvalidateSearchCache

func (c *Gorm2Cache) InvalidateSearchCache(ctx context.Context, tableName string) error

func (*Gorm2Cache) Name

func (c *Gorm2Cache) Name() string

func (*Gorm2Cache) ResetCache

func (c *Gorm2Cache) ResetCache() error

func (*Gorm2Cache) ResetHitCount

func (c *Gorm2Cache) ResetHitCount()

func (*Gorm2Cache) SearchKeyExists

func (c *Gorm2Cache) SearchKeyExists(ctx context.Context, tableName string, SQL string, vars ...any) (bool, error)

func (*Gorm2Cache) SetSearchCache

func (c *Gorm2Cache) SetSearchCache(ctx context.Context, cacheValue string, tableName string,
	sql string, vars ...any) error

Jump to

Keyboard shortcuts

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