Documentation
¶
Index ¶
- type CachedGroupsResult
- type Newsgroup
- type NewsgroupCache
- func (nc *NewsgroupCache) Clear()
- func (nc *NewsgroupCache) Get(page, pageSize int) ([]*Newsgroup, int, bool)
- func (nc *NewsgroupCache) GetCachedSize() int64
- func (nc *NewsgroupCache) GetCachedSizeHuman() string
- func (nc *NewsgroupCache) GetStats() map[string]interface{}
- func (nc *NewsgroupCache) Remove(page, pageSize int)
- func (nc *NewsgroupCache) Set(page, pageSize int, groups []*Newsgroup, totalCount int)
- func (nc *NewsgroupCache) Stop()
- type SanitizedArticle
- type SanitizedCache
- func (sc *SanitizedCache) BatchSetArticles(articles map[string]map[string]template.HTML)
- func (sc *SanitizedCache) Clear()
- func (sc *SanitizedCache) GetArticle(messageID string) (*SanitizedArticle, bool)
- func (sc *SanitizedCache) GetCachedSize() int64
- func (sc *SanitizedCache) GetCachedSizeHuman() string
- func (sc *SanitizedCache) GetField(messageID string, field string) (template.HTML, bool)
- func (sc *SanitizedCache) SetArticle(messageID string, sanitizedFields map[string]template.HTML)
- func (sc *SanitizedCache) SetField(messageID string, field string, value template.HTML)
- func (sc *SanitizedCache) Stats() map[string]interface{}
- func (sc *SanitizedCache) Stop()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CachedGroupsResult ¶
type CachedGroupsResult struct { Groups []*Newsgroup TotalCount int CreatedAt time.Time LastUsed time.Time Size int64 // Estimated memory size }
CachedGroupsResult holds cached newsgroup data with pagination info
type Newsgroup ¶
type Newsgroup struct { ID int `json:"id"` Name string `json:"name"` Active bool `json:"active"` Description string `json:"description"` LastArticle int64 `json:"last_article"` MessageCount int64 `json:"message_count"` ExpiryDays int `json:"expiry_days"` MaxArticles int `json:"max_articles"` MaxArtSize int `json:"max_art_size"` HighWater int `json:"high_water"` LowWater int `json:"low_water"` Status string `json:"status"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
Newsgroup represents a newsgroup for caching (avoiding import cycle)
type NewsgroupCache ¶
type NewsgroupCache struct {
// contains filtered or unexported fields
}
NewsgroupCache provides caching for newsgroup listings with pagination
func NewNewsgroupCache ¶
func NewNewsgroupCache(maxEntries int, maxAge time.Duration) *NewsgroupCache
NewNewsgroupCache creates a new newsgroup cache with specified limits
func (*NewsgroupCache) Get ¶
func (nc *NewsgroupCache) Get(page, pageSize int) ([]*Newsgroup, int, bool)
Get retrieves cached newsgroup data for a specific page
func (*NewsgroupCache) GetCachedSize ¶
func (nc *NewsgroupCache) GetCachedSize() int64
GetCachedSize returns the current cache size in bytes
func (*NewsgroupCache) GetCachedSizeHuman ¶
func (nc *NewsgroupCache) GetCachedSizeHuman() string
GetCachedSizeHuman returns human-readable cache size
func (*NewsgroupCache) GetStats ¶
func (nc *NewsgroupCache) GetStats() map[string]interface{}
GetStats returns cache statistics
func (*NewsgroupCache) Remove ¶
func (nc *NewsgroupCache) Remove(page, pageSize int)
Remove removes a specific cache entry
type SanitizedArticle ¶
type SanitizedArticle struct { Subject template.HTML Author template.HTML Body template.HTML Date template.HTML References template.HTML MessageID template.HTML Path template.HTML HeadersJSON template.HTML DateSince template.HTML // Add other fields as needed CreatedAt time.Time LastUsed time.Time Size int64 // contains filtered or unexported fields }
SanitizedArticle holds all sanitized fields for an article
type SanitizedCache ¶
type SanitizedCache struct {
// contains filtered or unexported fields
}
SanitizedCache provides caching for complete sanitized articles
func NewSanitizedCache ¶
func NewSanitizedCache(maxEntries int, maxAge time.Duration) *SanitizedCache
NewSanitizedCache creates a new cache with specified limits
func (*SanitizedCache) BatchSetArticles ¶
func (sc *SanitizedCache) BatchSetArticles(articles map[string]map[string]template.HTML)
BatchSetArticles efficiently stores multiple complete sanitized articles
func (*SanitizedCache) Clear ¶
func (sc *SanitizedCache) Clear()
Clear removes all entries from the cache
func (*SanitizedCache) GetArticle ¶
func (sc *SanitizedCache) GetArticle(messageID string) (*SanitizedArticle, bool)
GetArticle retrieves a complete cached sanitized article
func (*SanitizedCache) GetCachedSize ¶
func (sc *SanitizedCache) GetCachedSize() int64
func (*SanitizedCache) GetCachedSizeHuman ¶
func (sc *SanitizedCache) GetCachedSizeHuman() string
func (*SanitizedCache) GetField ¶
GetField retrieves a specific sanitized field from a cached article
func (*SanitizedCache) SetArticle ¶
func (sc *SanitizedCache) SetArticle(messageID string, sanitizedFields map[string]template.HTML)
SetArticle stores a complete sanitized article in one operation
func (*SanitizedCache) SetField ¶
func (sc *SanitizedCache) SetField(messageID string, field string, value template.HTML)
SetField stores a single sanitized field, creating or updating the article entry
func (*SanitizedCache) Stats ¶
func (sc *SanitizedCache) Stats() map[string]interface{}
Stats returns cache statistics
func (*SanitizedCache) Stop ¶
func (sc *SanitizedCache) Stop()
Stop shuts down the cache and cleanup goroutine