Documentation
¶
Index ¶
- Constants
- type Cache
- func (c *Cache[K, V]) Delete(key K)
- func (c *Cache[K, V]) DeleteAll()
- func (c *Cache[K, V]) DeleteCon(condition func(key K, value V) bool)
- func (c *Cache[K, V]) Load(key K) (value V, ok bool)
- func (c *Cache[K, V]) LoadOrStore(key K, value V) (actual V, loaded bool)
- func (c *Cache[K, V]) RangeAll() (values []V)
- func (c *Cache[K, V]) RangeCon(f func(key K, value V) bool) (values []V)
- func (c *Cache[K, V]) Store(key K, value V)
- func (c *Cache[K, V]) StoreAll(f func(value V) K, values []V)
- func (c *Cache[K, V]) StoreWithFunc(key K, value V, condition func(key K, value V) bool)
- type ConversationSeqContextCache
- func (c ConversationSeqContextCache) Delete(conversationID string, viewType int)
- func (c ConversationSeqContextCache) DeleteByViewType(viewType int)
- func (c ConversationSeqContextCache) Load(conversationID string, viewType int) (int64, bool)
- func (c ConversationSeqContextCache) Store(conversationID string, viewType int, thisEndSeq int64)
- func (c ConversationSeqContextCache) StoreWithFunc(conversationID string, viewType int, thisEndSeq int64, ...)
- type UserCache
Constants ¶
View Source
const ( ViewHistory = iota ViewSearch )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache[K comparable, V any] struct { // contains filtered or unexported fields }
Cache is a Generic sync.Map structure.
func NewCache ¶
func NewCache[K comparable, V any]() *Cache[K, V]
func (*Cache[K, V]) Delete ¶
func (c *Cache[K, V]) Delete(key K)
Delete deletes the value for a key.
func (*Cache[K, V]) DeleteCon ¶ added in v3.8.3
DeleteCon deletes the value for a key only if the provided condition function returns true.
func (*Cache[K, V]) Load ¶
Load returns the value stored in the map for a key, or nil if no value is present.
func (*Cache[K, V]) LoadOrStore ¶
LoadOrStore returns the existing value for the key if present.
func (*Cache[K, V]) RangeAll ¶
func (c *Cache[K, V]) RangeAll() (values []V)
RangeAll returns all values in the map.
func (*Cache[K, V]) Store ¶
func (c *Cache[K, V]) Store(key K, value V)
Store sets the value for a key.
func (*Cache[K, V]) StoreAll ¶
func (c *Cache[K, V]) StoreAll(f func(value V) K, values []V)
StoreAll sets all value by f's key.
func (*Cache[K, V]) StoreWithFunc ¶ added in v3.8.3
StoreWithFunc stores the value for a key only if the provided condition function returns true.
type ConversationSeqContextCache ¶ added in v3.8.3
func NewConversationSeqContextCache ¶ added in v3.8.3
func NewConversationSeqContextCache() *ConversationSeqContextCache
func (ConversationSeqContextCache) Delete ¶ added in v3.8.3
func (c ConversationSeqContextCache) Delete(conversationID string, viewType int)
func (ConversationSeqContextCache) DeleteByViewType ¶ added in v3.8.3
func (c ConversationSeqContextCache) DeleteByViewType(viewType int)
func (ConversationSeqContextCache) Load ¶ added in v3.8.3
func (c ConversationSeqContextCache) Load(conversationID string, viewType int) (int64, bool)
func (ConversationSeqContextCache) Store ¶ added in v3.8.3
func (c ConversationSeqContextCache) Store(conversationID string, viewType int, thisEndSeq int64)
func (ConversationSeqContextCache) StoreWithFunc ¶ added in v3.8.3
type UserCache ¶ added in v3.8.3
type UserCache[K comparable, V any] struct { *Cache[K, V] // contains filtered or unexported fields }
func NewUserCache ¶ added in v3.8.3
func (*UserCache[K, V]) BatchFetch ¶ added in v3.8.3
Click to show internal directories.
Click to hide internal directories.