Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is an in-memory container that uses a LRU eviction strategy. It also supports stale cache, i.e. cache entries have an expiration and when its due the entry is refresh with a background routine, never deleting the old value, only replacing it.
type Loader ¶
Loader is a strategy to fetch values not found or expired in cache.
func ParserCacheLoader ¶
ParserCacheLoader is the strategy to load values for the cached parser.
func QueryCacheLoader ¶
func QueryCacheLoader(qr persistence.QueryReader) Loader
QueryCacheLoader is the strategy to load values for the cached query reader.
func TenantCacheLoader ¶
func TenantCacheLoader(mr persistence.MappingsReader) Loader
TenantCacheLoader is the strategy to load values for the cached mappings reader.
type MappingsReaderCache ¶
type MappingsReaderCache struct {
// contains filtered or unexported fields
}
MappingsReaderCache is a caching wrapper that implements the MappingsReader interface.
func NewMappingsReaderCache ¶
func NewMappingsReaderCache(log restql.Logger, c *Cache) *MappingsReaderCache
NewMappingsReaderCache constructs a MappingsReaderCache instance.
func (*MappingsReaderCache) FromTenant ¶
func (c *MappingsReaderCache) FromTenant(ctx context.Context, tenant string) (map[string]restql.Mapping, error)
FromTenant returns a cached mapping index if present, fetching it otherwise.
type Option ¶
type Option func(c *Cache)
Option is a cache parameter configurator
func WithExpiration ¶
WithExpiration sets the time to live of cache entries.
func WithRefreshInterval ¶
WithRefreshInterval sets the interval between each execution of the background refresh routine.
func WithRefreshQueueLength ¶
WithRefreshQueueLength sets the maximum queue size of cache entries to be refreshed.
type ParserCache ¶
type ParserCache struct {
// contains filtered or unexported fields
}
ParserCache is a caching wrapper that implements the Parser interface.
func NewParserCache ¶
func NewParserCache(log restql.Logger, c *Cache) ParserCache
NewParserCache constructs a ParserCache instance.
type QueryReaderCache ¶
type QueryReaderCache struct {
// contains filtered or unexported fields
}
QueryReaderCache is a caching wrapper that implements the QueryReader interface.
func NewQueryReaderCache ¶
func NewQueryReaderCache(log restql.Logger, c *Cache) *QueryReaderCache
NewQueryReaderCache constructs a QueryReaderCache instance.
func (*QueryReaderCache) Get ¶
func (c *QueryReaderCache) Get(ctx context.Context, namespace, id string, revision int) (restql.SavedQueryRevision, error)
Get returns a cached saved query if present, fetching it otherwise.