cache

package
v1.0.1-i18n-fix Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Context = context.Background()
	Marshal *marshaler.Marshaler
	Manager *cache.ChainCache[any]
)

Functions

func GetAdminCacheUser

func GetAdminCacheUser(chatId, userId int64) (bool, gotgbot.MergedChatMember)

GetAdminCacheUser searches for a specific user in the cached administrator list of a chat. Returns true and the MergedChatMember if the user is found as an admin, false and empty MergedChatMember if not found or cache miss.

func InitCache

func InitCache() error

InitCache initializes the dual-layer cache system with Ristretto (L1) and Redis (L2). It establishes connections to both cache stores and returns an error if initialization fails.

Types

type AdminCache

type AdminCache struct {
	ChatId   int64
	UserInfo []gotgbot.MergedChatMember
	Cached   bool
}

func GetAdminCacheList

func GetAdminCacheList(chatId int64) (bool, AdminCache)

GetAdminCacheList retrieves the cached administrator list for a specific chat. Returns true and the AdminCache if found in cache, false and empty AdminCache if cache miss.

func LoadAdminCache

func LoadAdminCache(b *gotgbot.Bot, chatId int64) AdminCache

LoadAdminCache retrieves and caches the list of administrators for a given chat. It fetches the current administrators from Telegram API and stores them in cache with a 30-minute expiration. Returns an AdminCache struct containing the admin list.

Jump to

Keyboard shortcuts

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