2025-01-04 01:28:54 +05:30
|
|
|
package cache
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"time"
|
|
|
|
|
|
2025-05-03 18:30:07 +05:30
|
|
|
v3 "github.com/SigNoz/signoz/pkg/query-service/model/v3"
|
|
|
|
|
"github.com/SigNoz/signoz/pkg/types/cachetypes"
|
|
|
|
|
"github.com/SigNoz/signoz/pkg/valuer"
|
2025-01-04 01:28:54 +05:30
|
|
|
)
|
|
|
|
|
|
2025-05-03 18:30:07 +05:30
|
|
|
type Cache interface {
|
|
|
|
|
// Set sets the cacheable entity in cache.
|
|
|
|
|
Set(ctx context.Context, orgID valuer.UUID, cacheKey string, data cachetypes.Cacheable, ttl time.Duration) error
|
|
|
|
|
// Get gets the cacheble entity in the dest entity passed
|
|
|
|
|
Get(ctx context.Context, orgID valuer.UUID, cacheKey string, dest cachetypes.Cacheable, allowExpired bool) error
|
|
|
|
|
// Delete deletes the cacheable entity from cache
|
|
|
|
|
Delete(ctx context.Context, orgID valuer.UUID, cacheKey string)
|
|
|
|
|
// DeleteMany deletes multiple cacheble entities from cache
|
|
|
|
|
DeleteMany(ctx context.Context, orgID valuer.UUID, cacheKeys []string)
|
2025-01-04 01:28:54 +05:30
|
|
|
}
|
|
|
|
|
|
2025-05-03 18:30:07 +05:30
|
|
|
type KeyGenerator interface {
|
|
|
|
|
// GenerateKeys generates the cache keys for the given query range params
|
|
|
|
|
// The keys are returned as a map where the key is the query name and the value is the cache key
|
|
|
|
|
GenerateKeys(*v3.QueryRangeParamsV3) map[string]string
|
2025-01-04 01:28:54 +05:30
|
|
|
}
|