Documentation
¶
Index ¶
- func CacheUserPermissions(userID uint, method string, data interface{}, ttl time.Duration)
- func DeserializeCacheData(bytes []byte, target interface{}) error
- func GetCachedUserPermissions(userID uint, method string) (interface{}, bool)
- func InvalidateUserCache(userID uint)
- func InvalidateUserGroupCache(groupID uint, userIDs []uint)
- func SerializeCacheData(data interface{}) []byte
- type CacheEntry
- type MemoryCache
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CacheUserPermissions ¶
CacheUserPermissions caches user permission results with a standardized key format
func DeserializeCacheData ¶
DeserializeCacheData converts JSON back to data
func GetCachedUserPermissions ¶
GetCachedUserPermissions retrieves cached user permission results
func InvalidateUserCache ¶
func InvalidateUserCache(userID uint)
InvalidateUserCache invalidates all cached permissions for a user
func InvalidateUserGroupCache ¶
InvalidateUserGroupCache invalidates cache for all users affected by group changes
func SerializeCacheData ¶
func SerializeCacheData(data interface{}) []byte
SerializeCacheData converts data to JSON for consistent caching
Types ¶
type CacheEntry ¶
CacheEntry represents a cached item with expiry
type MemoryCache ¶
type MemoryCache struct {
// contains filtered or unexported fields
}
MemoryCache is a simple in-memory cache with TTL support
func (*MemoryCache) Delete ¶
func (c *MemoryCache) Delete(key string)
Delete removes a value from the cache
func (*MemoryCache) DeletePattern ¶
func (c *MemoryCache) DeletePattern(pattern string)
DeletePattern removes all keys matching a pattern (prefix)
func (*MemoryCache) Get ¶
func (c *MemoryCache) Get(key string) (interface{}, bool)
Get retrieves a value from the cache
Click to show internal directories.
Click to hide internal directories.