Documentation ¶
Index ¶
- Constants
- func NewPendingIndexItem(columns []string, key string, limit int64) *pendingIndexItem
- type CacheStats
- type IndexBucket
- type IndexItem
- type QueryCache
- func (c *QueryCache) CancelPendingItem(table string, qualMap map[string]*proto.Quals, columns []string, limit int64)
- func (c *QueryCache) Clear()
- func (c *QueryCache) Get(ctx context.Context, table string, qualMap map[string]*proto.Quals, ...) *QueryCacheResult
- func (c *QueryCache) Set(table string, qualMap map[string]*proto.Quals, columns []string, limit int64, ...) (res bool)
- type QueryCacheResult
Constants ¶
const ( // Key column CacheMatch values CacheMatchSubset = "subset" CacheMatchExact = "exact" )
Variables ¶
This section is empty.
Functions ¶
func NewPendingIndexItem ¶
Types ¶
type CacheStats ¶
type IndexBucket ¶
type IndexBucket struct {
Items []*IndexItem
}
IndexBucket contains index items for all cache results for a given table and qual set
func (*IndexBucket) Append ¶
func (b *IndexBucket) Append(item *IndexItem) *IndexBucket
type IndexItem ¶
type IndexItem struct { Columns []string Key string Limit int64 Quals map[string]*proto.Quals InsertionTime time.Time }
IndexItem stores the columns and cached index for a single cached query result note - this index item it tied to a specific table and set of quals
func NewIndexItem ¶
func (IndexItem) SatisfiesColumns ¶
SatisfiesColumns returns whether this index item satisfies the given columns used when determining whether this IndexItem satisfies a cache reques
func (IndexItem) SatisfiesLimit ¶
SatisfiesLimit returns whether this index item satisfies the given limit used when determining whether this IndexItem satisfies a cache reques
func (IndexItem) SatisfiesQuals ¶
func (i IndexItem) SatisfiesQuals(checkQualMap map[string]*proto.Quals, keyColumns map[string]*proto.KeyColumn) bool
SatisfiesQuals does this index item satisfy the check quals all data returned by check quals is returned by index quals
i.e. check quals must be a 'subset' of index quals eg our quals [], check quals [id="1"] -> SATISFIED our quals [id="1"], check quals [id="1"] -> SATISFIED our quals [id="1"], check quals [id="1", foo=2] -> SATISFIED our quals [id="1", foo=2], check quals [id="1"] -> NOT SATISFIED
NOTE: some columns cannot use this subset logic. Generally this applies to columns which represent a filter which is executed server side to filter the data returned. In this case, we only identify a cache hit if the cached data has the _same_ value for the given colummn
func (IndexItem) SatisfiesTtl ¶
SatisfiesTtl does this index item satisfy the ttl requirement
type QueryCache ¶
type QueryCache struct { Stats *CacheStats PluginSchema map[string]*proto.TableSchema // contains filtered or unexported fields }
func NewQueryCache ¶
func NewQueryCache(connectionName string, pluginSchema map[string]*proto.TableSchema) (*QueryCache, error)
func (*QueryCache) CancelPendingItem ¶
func (c *QueryCache) CancelPendingItem(table string, qualMap map[string]*proto.Quals, columns []string, limit int64)
CancelPendingItem cancels a pending item - called when an execute call fails for any reason
func (*QueryCache) Clear ¶
func (c *QueryCache) Clear()
type QueryCacheResult ¶
func (*QueryCacheResult) Append ¶
func (q *QueryCacheResult) Append(row *proto.Row)