Documentation
¶
Index ¶
- Constants
- func RegisterEventSubscriber[T event.Event](pub EventListener, subscriber EventSubscriber[T])
- type Client
- type Config
- type EventListener
- type EventPublisher
- type EventSubscriber
- type RedisIndexCreator
- type RedisMessage
- type RedisPublisherInitializer
- type TLSClientCache
- type TTLEntry
- type TTLMap
- func (m *TTLMap) Clear()
- func (m *TTLMap) Delete(key string)
- func (m *TTLMap) DeleteByPrefix(prefix string)
- func (m *TTLMap) Get(key string) (any, bool)
- func (m *TTLMap) Len() int
- func (m *TTLMap) Set(key string, value any)
- func (m *TTLMap) SetOnEvict(fn func(value any))
- func (m *TTLMap) TTL() time.Duration
- type TTLMapManager
Constants ¶
View Source
const ( GatewayTTLName = "gateway" RegistryTTLName = "backend" ConsumerTTLName = "consumer" RoleTTLName = "role" ConsumerDataTTLName = "consumer_data" PolicyTTLName = "policy" AuthTTLName = "auth" AuthKeyTTLName = "auth_key" LoadBalancerTTLName = "lb" // CatalogModelTTLName indexes catalog models by "providerCode:slug" for the // proxy plane's cost computation, so pricing avoids a DB round-trip on the // hot path after the first lookup. CatalogModelTTLName = "catalog_model" ConsumerPathTTLName = "consumer_path" MCPToolsTTLName = "mcp_tools" )
View Source
const ( GatewayCacheTTL = 1 * time.Hour RegistryCacheTTL = 5 * time.Minute ConsumerCacheTTL = 5 * time.Minute RoleCacheTTL = 5 * time.Minute ConsumerDataCacheTTL = 1 * time.Hour PolicyCacheTTL = 5 * time.Minute AuthCacheTTL = 5 * time.Minute AuthKeyCacheTTL = 5 * time.Minute LoadBalancerCacheTTL = 5 * time.Minute CatalogModelCacheTTL = 24 * time.Hour MCPToolsCacheTTL = 5 * time.Minute )
View Source
const (
GatewayKeyPattern = "gateway:%s"
)
Variables ¶
This section is empty.
Functions ¶
func RegisterEventSubscriber ¶
func RegisterEventSubscriber[T event.Event](pub EventListener, subscriber EventSubscriber[T])
Types ¶
type Client ¶
type Client interface {
Get(ctx context.Context, key string) (string, error)
Set(ctx context.Context, key string, value string, expiration time.Duration) error
Delete(ctx context.Context, key string) error
RedisClient() *redis.Client
CreateTTLMap(name string, ttl time.Duration) *TTLMap
GetTTLMap(name string) *TTLMap
GetGateway(ctx context.Context, id string) (*domain.Gateway, error)
SaveGateway(ctx context.Context, gateway *domain.Gateway) error
DeleteAllByGatewayID(ctx context.Context, gatewayID string) error
InvalidateAll(ctx context.Context) error
ClearAllTTLMaps()
}
type EventListener ¶
type EventListener interface {
Listen(ctx context.Context, channels ...channel.Channel)
Register(eventType reflect.Type, subscriber interface{})
}
func NewRedisEventListener ¶
type EventPublisher ¶
func NewRedisEventPublisher ¶
func NewRedisEventPublisher(cache Client, channel channel.Channel) EventPublisher
type EventSubscriber ¶
type RedisIndexCreator ¶
func NewRedisIndexCreator ¶
func NewRedisIndexCreator(redis *redis.Client, logger *slog.Logger) RedisIndexCreator
type RedisMessage ¶
type RedisMessage struct {
Type string `json:"type"`
Event json.RawMessage `json:"event"`
}
type RedisPublisherInitializer ¶
type RedisPublisherInitializer func(cache Client, channel channel.Channel) EventPublisher
type TLSClientCache ¶
type TLSClientCache struct {
// contains filtered or unexported fields
}
func NewTLSClientCache ¶
func NewTLSClientCache(logger *slog.Logger) *TLSClientCache
func (*TLSClientCache) GetOrCreate ¶
type TTLMap ¶
type TTLMap struct {
// contains filtered or unexported fields
}
func (*TTLMap) DeleteByPrefix ¶
DeleteByPrefix removes every entry whose key starts with prefix, firing onEvict for each so resource-owning values (e.g. load balancers keyed by "<gatewayID>:<consumerID>") are released. Used to evict all entries scoped to a gateway when its configuration changes.
func (*TTLMap) SetOnEvict ¶
SetOnEvict registers a callback run with each value as it leaves the map (via Set replacement, Delete, Clear or TTL expiry), letting a namespace release resources tied to cached values. The callback runs outside the map lock.
type TTLMapManager ¶
type TTLMapManager struct {
// contains filtered or unexported fields
}
func NewTTLMapManager ¶
func NewTTLMapManager(defaultTTL time.Duration) *TTLMapManager
func (*TTLMapManager) ClearAllTTLMaps ¶
func (m *TTLMapManager) ClearAllTTLMaps()
func (*TTLMapManager) CreateTTLMap ¶
func (m *TTLMapManager) CreateTTLMap(name string, ttl time.Duration) *TTLMap
func (*TTLMapManager) DefaultTTL ¶
func (m *TTLMapManager) DefaultTTL() time.Duration
func (*TTLMapManager) GetTTLMap ¶
func (m *TTLMapManager) GetTTLMap(name string) *TTLMap
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package cachetest provides cache test doubles shared across app-layer tests.
|
Package cachetest provides cache test doubles shared across app-layer tests. |
|
Package semantic provides a Redis Stack (RediSearch) vector store used by the semantic cache plugin to look up and persist responses by embedding similarity, scoped per rule via a hashed tag.
|
Package semantic provides a Redis Stack (RediSearch) vector store used by the semantic cache plugin to look up and persist responses by embedding similarity, scoped per rule via a hashed tag. |
Click to show internal directories.
Click to hide internal directories.