Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CacheEntry ¶
CacheEntry holds a cached HTML fragment with expiry tracking.
func (*CacheEntry) Age ¶
func (e *CacheEntry) Age() time.Duration
Age returns how old this cache entry is.
func (*CacheEntry) IsExpired ¶
func (e *CacheEntry) IsExpired() bool
IsExpired returns true if the cache entry has expired.
type FragmentCache ¶
type FragmentCache struct {
// contains filtered or unexported fields
}
FragmentCache is an LRU+TTL cache for HTML fragments from remote contributors.
func NewFragmentCache ¶
func NewFragmentCache(maxSize int, ttl time.Duration) *FragmentCache
NewFragmentCache creates a new fragment cache.
func (*FragmentCache) Delete ¶
func (c *FragmentCache) Delete(key string)
Delete removes a cached entry.
func (*FragmentCache) Get ¶
func (c *FragmentCache) Get(key string) *CacheEntry
Get retrieves a cached fragment. Returns nil if not found or expired.
func (*FragmentCache) GetStale ¶
func (c *FragmentCache) GetStale(key string) *CacheEntry
GetStale retrieves a cached fragment even if expired. This is used by the recovery system to serve stale content when remotes are down.
func (*FragmentCache) Set ¶
func (c *FragmentCache) Set(key string, data []byte)
Set stores a fragment in the cache.
func (*FragmentCache) Size ¶
func (c *FragmentCache) Size() int
Size returns the number of cached entries.
type FragmentProxy ¶
type FragmentProxy struct {
// contains filtered or unexported fields
}
FragmentProxy fetches HTML fragments from remote contributors with caching. It provides the primary integration between the dashboard shell and remote services.
func NewFragmentProxy ¶
func NewFragmentProxy( registry *contributor.ContributorRegistry, cacheMaxSize int, cacheTTL time.Duration, timeout time.Duration, logger forge.Logger, ) *FragmentProxy
NewFragmentProxy creates a new fragment proxy.
func (*FragmentProxy) Cache ¶
func (p *FragmentProxy) Cache() *FragmentCache
Cache returns the underlying fragment cache (for metrics/status reporting).
func (*FragmentProxy) FetchPage ¶
FetchPage fetches a page fragment from a remote contributor, using cache when available.
func (*FragmentProxy) FetchWidget ¶
FetchWidget fetches a widget fragment from a remote contributor, using cache when available.
func (*FragmentProxy) InvalidateContributor ¶
func (p *FragmentProxy) InvalidateContributor(name string)
InvalidateContributor removes all cached fragments for a contributor.