caches

package
v0.0.0-...-da4b772 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Finalized finalizationType = iota
	None
)

Variables

View Source
var EmptyResponses = [][]byte{
	[]byte(`"0x"`),
	[]byte(`null`),
	[]byte(`{}`),
	[]byte(`[]`),
}
View Source
var ErrCacheNotFound = errors.New("not found in cache")

Functions

This section is empty.

Types

type BaseCacheProcessor

type BaseCacheProcessor struct {
	// contains filtered or unexported fields
}

func NewBaseCacheProcessor

func NewBaseCacheProcessor(
	upstreamSupervisor upstreams.UpstreamSupervisor,
	cacheConfig *config.CacheConfig,
	storageRegistry *storages.StorageRegistry,
) (*BaseCacheProcessor, error)

func (*BaseCacheProcessor) Receive

func (c *BaseCacheProcessor) Receive(ctx context.Context, chain chains.Chain, request protocol.RequestHolder) ([]byte, bool)

func (*BaseCacheProcessor) Store

func (c *BaseCacheProcessor) Store(
	ctx context.Context,
	chain chains.Chain,
	request protocol.RequestHolder,
	response []byte,
)

type CacheConnector

type CacheConnector interface {
	Id() string
	Store(ctx context.Context, key string, object string, ttl time.Duration) error
	Receive(ctx context.Context, key string) ([]byte, error)
	Initialize() error
}

type CachePolicy

type CachePolicy struct {
	// contains filtered or unexported fields
}

func NewCachePolicy

func NewCachePolicy(
	upstreamSupervisor upstreams.UpstreamSupervisor,
	cacheConnector CacheConnector,
	policyConfig *config.CachePolicyConfig,
) *CachePolicy

func (*CachePolicy) Receive

func (c *CachePolicy) Receive(ctx context.Context, chain chains.Chain, request protocol.RequestHolder) ([]byte, bool)

func (*CachePolicy) Store

func (c *CachePolicy) Store(
	ctx context.Context,
	chain chains.Chain,
	request protocol.RequestHolder,
	response []byte,
) bool

type CacheProcessor

type CacheProcessor interface {
	Store(ctx context.Context, chain chains.Chain, request protocol.RequestHolder, response []byte)
	Receive(ctx context.Context, chain chains.Chain, request protocol.RequestHolder) ([]byte, bool)
}

type InMemoryConnector

type InMemoryConnector struct {
	// contains filtered or unexported fields
}

func NewInMemoryConnector

func NewInMemoryConnector(id string, config *config.MemoryCacheConnectorConfig) (*InMemoryConnector, error)

func (*InMemoryConnector) Id

func (i *InMemoryConnector) Id() string

func (*InMemoryConnector) Initialize

func (i *InMemoryConnector) Initialize() error

func (*InMemoryConnector) Receive

func (i *InMemoryConnector) Receive(_ context.Context, key string) ([]byte, error)

func (*InMemoryConnector) Store

func (i *InMemoryConnector) Store(_ context.Context, key string, object string, ttl time.Duration) error

type PostgresConnector

type PostgresConnector struct {
	// contains filtered or unexported fields
}

func NewPostgresConnector

func NewPostgresConnector(id string, postgresCfg *config.PostgresCacheConnectorConfig, storageRegistry *storages.StorageRegistry) (*PostgresConnector, error)

func (*PostgresConnector) Id

func (p *PostgresConnector) Id() string

func (*PostgresConnector) Initialize

func (p *PostgresConnector) Initialize() error

func (*PostgresConnector) Receive

func (p *PostgresConnector) Receive(ctx context.Context, key string) ([]byte, error)

func (*PostgresConnector) Store

func (p *PostgresConnector) Store(ctx context.Context, key string, object string, ttl time.Duration) error

type RedisConnector

type RedisConnector struct {
	// contains filtered or unexported fields
}

func NewRedisConnector

func NewRedisConnector(id string, redisConfig *config.RedisCacheConnectorConfig, storageRegistry *storages.StorageRegistry) (*RedisConnector, error)

func (*RedisConnector) Id

func (r *RedisConnector) Id() string

func (*RedisConnector) Initialize

func (r *RedisConnector) Initialize() error

func (*RedisConnector) Receive

func (r *RedisConnector) Receive(ctx context.Context, key string) ([]byte, error)

func (*RedisConnector) Store

func (r *RedisConnector) Store(ctx context.Context, key string, object string, ttl time.Duration) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL