redis

package
v0.0.0-...-d931726 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get[T any](
	r *RedisMiddleware,
	key string,
	fallback func() (T, error),
) (val T, err error)

func Set

func Set[T any](r *RedisMiddleware, key string, val T) error

Types

type RedisMiddleware

type RedisMiddleware struct {
	database.Database
	// contains filtered or unexported fields
}

RedisMiddleware implements the Database interface for Redis.

This driver can only be used as caching middleware and consumes another database driver. Incomming database requests are looked up in the cache and values are returned from cache instead of requesting the database if the value is existent. Otherwise, the value is requested from database and then stored to cache. On setting database values, values are set in database as same as in the cache.

func NewRedisMiddleware

func NewRedisMiddleware(db database.Database, rd *redis.Client) *RedisMiddleware

func (*RedisMiddleware) AddKarmaBlockList

func (r *RedisMiddleware) AddKarmaBlockList(guildID, userID string) (err error)

func (*RedisMiddleware) Close

func (r *RedisMiddleware) Close()

func (*RedisMiddleware) Connect

func (r *RedisMiddleware) Connect(credentials ...interface{}) error

func (*RedisMiddleware) DeleteAPIToken

func (r *RedisMiddleware) DeleteAPIToken(userID string) (err error)

func (*RedisMiddleware) GetAPIToken

func (r *RedisMiddleware) GetAPIToken(userID string) (t models.APITokenEntry, err error)

func (*RedisMiddleware) GetAntiraidBurst

func (r *RedisMiddleware) GetAntiraidBurst(guildID string) (int, error)

func (*RedisMiddleware) GetAntiraidRegeneration

func (r *RedisMiddleware) GetAntiraidRegeneration(guildID string) (int, error)

func (*RedisMiddleware) GetAntiraidState

func (r *RedisMiddleware) GetAntiraidState(guildID string) (bool, error)

func (*RedisMiddleware) GetGuildAPI

func (r *RedisMiddleware) GetGuildAPI(guildID string) (settings models.GuildAPISettings, err error)

func (*RedisMiddleware) GetGuildAutoRole

func (r *RedisMiddleware) GetGuildAutoRole(guildID string) ([]string, error)

func (*RedisMiddleware) GetGuildAutoVC

func (r *RedisMiddleware) GetGuildAutoVC(guildID string) ([]string, error)

func (*RedisMiddleware) GetGuildBackup

func (r *RedisMiddleware) GetGuildBackup(guildID string) (bool, error)

func (*RedisMiddleware) GetGuildBirthdayChan

func (r *RedisMiddleware) GetGuildBirthdayChan(guildID string) (string, error)

func (*RedisMiddleware) GetGuildCodeExecEnabled

func (r *RedisMiddleware) GetGuildCodeExecEnabled(guildID string) (bool, error)

func (*RedisMiddleware) GetGuildColorReaction

func (r *RedisMiddleware) GetGuildColorReaction(guildID string) (bool, error)

func (*RedisMiddleware) GetGuildGhostpingMsg

func (r *RedisMiddleware) GetGuildGhostpingMsg(guildID string) (string, error)

func (*RedisMiddleware) GetGuildInviteBlock

func (r *RedisMiddleware) GetGuildInviteBlock(guildID string) (string, error)

func (*RedisMiddleware) GetGuildJdoodleKey

func (r *RedisMiddleware) GetGuildJdoodleKey(guildID string) (string, error)

func (*RedisMiddleware) GetGuildJoinMsg

func (r *RedisMiddleware) GetGuildJoinMsg(guildID string) (string, string, error)

func (*RedisMiddleware) GetGuildLeaveMsg

func (r *RedisMiddleware) GetGuildLeaveMsg(guildID string) (string, string, error)

func (*RedisMiddleware) GetGuildLogDisable

func (r *RedisMiddleware) GetGuildLogDisable(guildID string) (bool, error)

func (*RedisMiddleware) GetGuildModLog

func (r *RedisMiddleware) GetGuildModLog(guildID string) (string, error)

func (*RedisMiddleware) GetGuildNotifyRole

func (r *RedisMiddleware) GetGuildNotifyRole(guildID string) (string, error)

func (*RedisMiddleware) GetGuildPrefix

func (r *RedisMiddleware) GetGuildPrefix(guildID string) (string, error)

func (*RedisMiddleware) GetGuildVerificationRequired

func (r *RedisMiddleware) GetGuildVerificationRequired(guildID string) (bool, error)

func (*RedisMiddleware) GetGuildVoiceLog

func (r *RedisMiddleware) GetGuildVoiceLog(guildID string) (string, error)

func (*RedisMiddleware) GetKarmaEmotes

func (r *RedisMiddleware) GetKarmaEmotes(guildID string) (emotesInc, emotesDec string, err error)

func (*RedisMiddleware) GetKarmaPenalty

func (r *RedisMiddleware) GetKarmaPenalty(guildID string) (bool, error)

func (*RedisMiddleware) GetKarmaState

func (r *RedisMiddleware) GetKarmaState(guildID string) (bool, error)

func (*RedisMiddleware) GetKarmaTokens

func (r *RedisMiddleware) GetKarmaTokens(guildID string) (int, error)

func (*RedisMiddleware) GetSetting

func (r *RedisMiddleware) GetSetting(setting string) (string, error)

func (*RedisMiddleware) GetStarboardConfig

func (r *RedisMiddleware) GetStarboardConfig(guildID string) (config models.StarboardConfig, err error)

func (*RedisMiddleware) GetUserOTAEnabled

func (r *RedisMiddleware) GetUserOTAEnabled(userID string) (bool, error)

func (*RedisMiddleware) IsKarmaBlockListed

func (r *RedisMiddleware) IsKarmaBlockListed(guildID, userID string) (ok bool, err error)

func (*RedisMiddleware) RemoveKarmaBlockList

func (r *RedisMiddleware) RemoveKarmaBlockList(guildID, userID string) (err error)

func (*RedisMiddleware) SetAPIToken

func (r *RedisMiddleware) SetAPIToken(token models.APITokenEntry) (err error)

func (*RedisMiddleware) SetAntiraidBurst

func (r *RedisMiddleware) SetAntiraidBurst(guildID string, burst int) error

func (*RedisMiddleware) SetAntiraidRegeneration

func (r *RedisMiddleware) SetAntiraidRegeneration(guildID string, limit int) error

func (*RedisMiddleware) SetAntiraidState

func (r *RedisMiddleware) SetAntiraidState(guildID string, state bool) error

func (*RedisMiddleware) SetGuildAPI

func (r *RedisMiddleware) SetGuildAPI(guildID string, settings models.GuildAPISettings) (err error)

func (*RedisMiddleware) SetGuildAutoRole

func (r *RedisMiddleware) SetGuildAutoRole(guildID string, autoRoleIDs []string) error

func (*RedisMiddleware) SetGuildAutoVC

func (r *RedisMiddleware) SetGuildAutoVC(guildID string, autoVCIDs []string) error

func (*RedisMiddleware) SetGuildBackup

func (r *RedisMiddleware) SetGuildBackup(guildID string, enabled bool) error

func (*RedisMiddleware) SetGuildBirthdayChan

func (r *RedisMiddleware) SetGuildBirthdayChan(guildID, newPrefix string) error

func (*RedisMiddleware) SetGuildCodeExecEnabled

func (r *RedisMiddleware) SetGuildCodeExecEnabled(guildID string, enabled bool) error

func (*RedisMiddleware) SetGuildColorReaction

func (r *RedisMiddleware) SetGuildColorReaction(guildID string, enabled bool) error

func (*RedisMiddleware) SetGuildGhostpingMsg

func (r *RedisMiddleware) SetGuildGhostpingMsg(guildID, msg string) error

func (*RedisMiddleware) SetGuildInviteBlock

func (r *RedisMiddleware) SetGuildInviteBlock(guildID string, data string) error

func (*RedisMiddleware) SetGuildJdoodleKey

func (r *RedisMiddleware) SetGuildJdoodleKey(guildID, jdkey string) error

func (*RedisMiddleware) SetGuildJoinMsg

func (r *RedisMiddleware) SetGuildJoinMsg(guildID string, channelID string, msg string) error

func (*RedisMiddleware) SetGuildLeaveMsg

func (r *RedisMiddleware) SetGuildLeaveMsg(guildID string, channelID string, msg string) error

func (*RedisMiddleware) SetGuildLogDisable

func (r *RedisMiddleware) SetGuildLogDisable(guildID string, enabled bool) error

func (*RedisMiddleware) SetGuildModLog

func (r *RedisMiddleware) SetGuildModLog(guildID, chanID string) error

func (*RedisMiddleware) SetGuildNotifyRole

func (r *RedisMiddleware) SetGuildNotifyRole(guildID, roleID string) error

func (*RedisMiddleware) SetGuildPrefix

func (r *RedisMiddleware) SetGuildPrefix(guildID, newPrefix string) error

func (*RedisMiddleware) SetGuildVerificationRequired

func (r *RedisMiddleware) SetGuildVerificationRequired(guildID string, enabled bool) error

func (*RedisMiddleware) SetGuildVoiceLog

func (r *RedisMiddleware) SetGuildVoiceLog(guildID, chanID string) error

func (*RedisMiddleware) SetKarmaEmotes

func (r *RedisMiddleware) SetKarmaEmotes(guildID, emotesInc, emotesDec string) error

func (*RedisMiddleware) SetKarmaPenalty

func (r *RedisMiddleware) SetKarmaPenalty(guildID string, state bool) error

func (*RedisMiddleware) SetKarmaState

func (r *RedisMiddleware) SetKarmaState(guildID string, state bool) error

func (*RedisMiddleware) SetKarmaTokens

func (r *RedisMiddleware) SetKarmaTokens(guildID string, tokens int) error

func (*RedisMiddleware) SetSetting

func (r *RedisMiddleware) SetSetting(setting, value string) error

func (*RedisMiddleware) SetStarboardConfig

func (r *RedisMiddleware) SetStarboardConfig(config models.StarboardConfig) (err error)

func (*RedisMiddleware) SetUserOTAEnabled

func (r *RedisMiddleware) SetUserOTAEnabled(userID string, enabled bool) error

Jump to

Keyboard shortcuts

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