Documentation ¶
Index ¶
- Constants
- Variables
- func HandleInvalidateCacheEvt(event *pubsub.Event)
- func InitDatabases()
- func InvalidateGuildCache(guildID interface{}, conf GuildConfig)
- func KeyGuildConfig(guildID int64, configName string) string
- func RegisterConfig(stor Storage, conf GuildConfig)
- func StrID(id int64) string
- type CachedStorage
- type GuildConfig
- type GuildConfigModel
- type PostFetchHandler
- type Postgres
- type Storage
Constants ¶
View Source
const MaxRetries = 1000
Variables ¶
Functions ¶
func InitDatabases ¶
func InitDatabases()
func InvalidateGuildCache ¶
func InvalidateGuildCache(guildID interface{}, conf GuildConfig)
InvalidateGuildCache is a helper that both instantly invalides the local application cache As well as sending the pusub event
func KeyGuildConfig ¶
func RegisterConfig ¶
func RegisterConfig(stor Storage, conf GuildConfig)
Types ¶
type CachedStorage ¶
type CachedStorage struct {
// contains filtered or unexported fields
}
func NewCached ¶
func NewCached() *CachedStorage
func (*CachedStorage) GetGuildConfig ¶
func (c *CachedStorage) GetGuildConfig(ctx context.Context, guildID int64, dest GuildConfig) error
func (*CachedStorage) InvalidateCache ¶
func (c *CachedStorage) InvalidateCache(guildID int64, config string)
type GuildConfig ¶
type GuildConfigModel ¶
type GuildConfigModel struct { GuildID int64 `gorm:"primary_key"` CreatedAt time.Time UpdatedAt time.Time }
func (*GuildConfigModel) GetGuildID ¶
func (gm *GuildConfigModel) GetGuildID() int64
func (*GuildConfigModel) GetUpdatedAt ¶
func (gm *GuildConfigModel) GetUpdatedAt() time.Time
type PostFetchHandler ¶
type PostFetchHandler interface { // Called after retrieving from underlying storage, before being put in cache // use this for any post processing etc.. PostFetch() }
type Postgres ¶
type Postgres struct{}
func (*Postgres) GetGuildConfig ¶
conf is requried to be a pointer value
func (*Postgres) SetGuildConfig ¶
func (p *Postgres) SetGuildConfig(ctx context.Context, conf GuildConfig) error
conf is requried to be a pointer value
func (*Postgres) SetIfLatest ¶
Click to show internal directories.
Click to hide internal directories.