Documentation
¶
Index ¶
- Variables
- func ValidateCacheZoneStrategy(zones []appconfig.Zone, name, strategy string) error
- type Config
- type DiskZoneStore
- type MemoryZoneStore
- func (s *MemoryZoneStore) Close()
- func (s *MemoryZoneStore) Delete(key string) bool
- func (s *MemoryZoneStore) DeleteVariants(key string) bool
- func (s *MemoryZoneStore) Load(key string) (SharedCacheEntry, bool)
- func (s *MemoryZoneStore) Store(key string, entry SharedCacheEntry)
- func (s *MemoryZoneStore) StoreVariant(key string, requestHeader http.Header, shared SharedCacheEntry)
- func (s *MemoryZoneStore) VariantKey(key string, requestHeader http.Header) string
- type Plugin
- func (p *Plugin) Config() any
- func (p *Plugin) Handler(next http.Handler) http.Handler
- func (p *Plugin) Init() error
- func (p *Plugin) PostInit() error
- func (p *Plugin) RunFinalResponseStore(r *http.Request, state base.ResponseState) error
- func (p *Plugin) RunHeaderFilter(r *http.Request, state *base.ResponseState) error
- func (p *Plugin) RunRequestPhase(w http.ResponseWriter, r *http.Request) base.RequestPhaseResult
- func (p *Plugin) SetConfiguredZones(zones []appconfig.Zone)
- func (p *Plugin) Stop()
- type SharedCacheEntry
Constants ¶
This section is empty.
Variables ¶
var ErrStoreIntentAlreadyConsumed = errors.New("proxy-cache store intent already consumed")
Functions ¶
Types ¶
type Config ¶
type Config struct {
CacheZone string `json:"cache_zone,omitempty"`
CacheStrategy string `json:"cache_strategy,omitempty"`
CacheKey []string `json:"cache_key,omitempty"`
CacheBypass []string `json:"cache_bypass,omitempty"`
CacheMethod []string `json:"cache_method,omitempty"`
CacheHTTPStatus []int `json:"cache_http_status,omitempty"`
HideCacheHeaders bool `json:"hide_cache_headers,omitempty"`
CacheControl bool `json:"cache_control,omitempty"`
NoCache []string `json:"no_cache,omitempty"`
CacheTTL int `json:"cache_ttl,omitempty"`
ConsumerIsolation bool `json:"consumer_isolation,omitempty"`
CacheSetCookie bool `json:"cache_set_cookie,omitempty"`
// contains filtered or unexported fields
}
func (*Config) UnmarshalJSON ¶
type DiskZoneStore ¶
type DiskZoneStore struct {
// contains filtered or unexported fields
}
DiskZoneStore exposes the common versioned disk envelope to plugins that share a configured proxy-cache zone. It deliberately leaves cache-key and vary-index policy to the owning plugin.
func NewDiskZoneStore ¶
NewDiskZoneStore resolves and prepares a disk store from an immutable generation-local zone snapshot.
func (*DiskZoneStore) Cleanup ¶
func (s *DiskZoneStore) Cleanup(now time.Time)
func (*DiskZoneStore) Delete ¶
func (s *DiskZoneStore) Delete(storageKey string) bool
func (*DiskZoneStore) Load ¶
func (s *DiskZoneStore) Load(storageKey string, now time.Time) (SharedCacheEntry, bool, bool)
Load returns expired=true when an existing entry was removed because its TTL elapsed. This lets the caller preserve APISIX's visible EXPIRED status.
func (*DiskZoneStore) Store ¶
func (s *DiskZoneStore) Store(storageKey string, entry SharedCacheEntry) error
type MemoryZoneStore ¶
type MemoryZoneStore struct {
// contains filtered or unexported fields
}
MemoryZoneStore provides a reference-counted view of a configured memory zone. It is used by proxy-cache and graphql-proxy-cache to share the same entries without exposing the plugin's internal vary index.
func AcquireMemoryZoneStore ¶
func AcquireMemoryZoneStore(zones []appconfig.Zone, name string) *MemoryZoneStore
AcquireMemoryZoneStore acquires a store from an immutable generation-local zone snapshot.
func (*MemoryZoneStore) Close ¶
func (s *MemoryZoneStore) Close()
func (*MemoryZoneStore) Delete ¶
func (s *MemoryZoneStore) Delete(key string) bool
func (*MemoryZoneStore) DeleteVariants ¶
func (s *MemoryZoneStore) DeleteVariants(key string) bool
DeleteVariants removes all request variants for one base cache key.
func (*MemoryZoneStore) Load ¶
func (s *MemoryZoneStore) Load(key string) (SharedCacheEntry, bool)
func (*MemoryZoneStore) Store ¶
func (s *MemoryZoneStore) Store(key string, entry SharedCacheEntry)
func (*MemoryZoneStore) StoreVariant ¶
func (s *MemoryZoneStore) StoreVariant(key string, requestHeader http.Header, shared SharedCacheEntry)
StoreVariant atomically admits both the entry and its Vary metadata to the configured zone. Oversized entries leave the existing variants untouched.
func (*MemoryZoneStore) VariantKey ¶
func (s *MemoryZoneStore) VariantKey(key string, requestHeader http.Header) string
VariantKey resolves a request against the zone-owned Vary index. The index is evicted and budgeted together with the entries it references.
type Plugin ¶
type Plugin struct {
base.BasePlugin
// contains filtered or unexported fields
}
func (*Plugin) RunFinalResponseStore ¶
func (*Plugin) RunHeaderFilter ¶
RunHeaderFilter hides client cache headers while retaining their upstream values for the later store's cacheability and TTL decisions.
func (*Plugin) RunRequestPhase ¶
func (p *Plugin) RunRequestPhase(w http.ResponseWriter, r *http.Request) base.RequestPhaseResult
func (*Plugin) SetConfiguredZones ¶
SetConfiguredZones supplies the generation-local proxy-cache zone snapshot before PostInit.
type SharedCacheEntry ¶
type SharedCacheEntry struct {
}
SharedCacheEntry is the cache envelope exchanged by plugins that use the configured proxy-cache zones. The fields intentionally mirror the persisted disk envelope so memory and disk strategies keep the same expiry contract.