package cache

import "github.com/google/certificate-transparency-go/trillian/ctfe/cache"

Package cache defines the IssuanceChainCache type, which allows different cache implementation with Get and Set operations.

Index

Types

type IssuanceChainCache

type IssuanceChainCache interface {
	// Get returns the issuance chain associated with the provided hash.
	Get(ctx context.Context, key []byte) ([]byte, error)

	// Set inserts the key-value pair of issuance chain.
	Set(ctx context.Context, key []byte, chain []byte) error
}

IssuanceChainCache is an interface which allows CTFE binaries to use different cache implementations for issuance chains.

func NewIssuanceChainCache

func NewIssuanceChainCache(_ context.Context, cacheType Type, option Option) (IssuanceChainCache, error)

NewIssuanceChainCache returns noop.IssuanceChainCache for noop type or lru.IssuanceChainCache for lru cache type.

type Option

type Option struct {
	Size int
	TTL  time.Duration
}

Option represents the cache option, which includes the cache size and time-to-live.

type Type

type Type string

Type represents the cache type.

const (
	Unknown Type = ""
	NOOP    Type = "noop"
	LRU     Type = "lru"
)

Type constants for the cache type.

Source Files

cache.go

Directories

PathSynopsis
trillian/ctfe/cache/lruPackage lru defines the IssuanceChainCache type, which implements IssuanceChainCache interface with Get and Set operations.
trillian/ctfe/cache/noopPackage noop defines the IssuanceChainCache type, which implements IssuanceChainCache interface with Get and Set operations.
Version
v1.3.1 (latest)
Published
Jan 15, 2025
Platform
linux/amd64
Imports
5 packages
Last checked
4 days ago

Tools for package owners.