cache

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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.

Directories

Path Synopsis
Package lru defines the IssuanceChainCache type, which implements IssuanceChainCache interface with Get and Set operations.
Package lru defines the IssuanceChainCache type, which implements IssuanceChainCache interface with Get and Set operations.
Package noop defines the IssuanceChainCache type, which implements IssuanceChainCache interface with Get and Set operations.
Package noop defines the IssuanceChainCache type, which implements IssuanceChainCache interface with Get and Set operations.

Jump to

Keyboard shortcuts

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