cache

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package cache provides functionality for cache storage

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsExpired added in v1.1.0

func IsExpired(ttl time.Duration) func(file backend.FileEntry) bool

IsExpired creates a function to check if file expired.

Types

type Cache

type Cache interface {
	Rebuilder
	Restorer
	Flusher
}

Cache defines Cache functionality and stores configuration.

func New

func New(logger log.Logger, s storage.Storage, a archive.Archive, g key.Generator, opts ...Option) Cache

New creates a new cache with given parameters.

type Flusher added in v1.1.0

type Flusher interface {
	// Flush removes files from the cache using given paths.
	Flush(srcs []string) error
}

Flusher is an interface represents a flush action.

func NewFlusher added in v1.1.0

func NewFlusher(logger log.Logger, s storage.Storage, ttl time.Duration) Flusher

NewFlusher creates a new cache flusher.

type Option added in v1.1.0

type Option interface {
	// contains filtered or unexported methods
}

Option overrides behavior of Archive.

func WithFallbackGenerator added in v1.1.0

func WithFallbackGenerator(g key.Generator) Option

WithFallbackGenerator sets fallback key generator option.

func WithNamespace added in v1.1.0

func WithNamespace(s string) Option

WithNamespace sets namespace option.

func WithOverride added in v1.1.0

func WithOverride(override bool) Option

WithOverride sets object should be overriten even if it already exists.

type Rebuilder added in v1.1.0

type Rebuilder interface {
	// Rebuild rebuilds cache from the files provided with given paths.
	Rebuild(srcs []string) error
}

Rebuilder is an interface represents a rebuild action.

func NewRebuilder added in v1.1.0

func NewRebuilder(logger log.Logger, s storage.Storage, a archive.Archive, g key.Generator, fg key.Generator, namespace string, override bool) Rebuilder

NewRebuilder creates a new cache.Rebuilder.

type Restorer added in v1.1.0

type Restorer interface {
	// Restore restores files from the cache provided with given paths.
	Restore(srcs []string) error
}

Restorer is an interface represents a restore action.

func NewRestorer added in v1.1.0

func NewRestorer(logger log.Logger, s storage.Storage, a archive.Archive, g key.Generator, fg key.Generator, namespace string) Restorer

NewRestorer creates a new cache.Restorer.

Jump to

Keyboard shortcuts

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