Help us shape the future of Go! Take the 2026 Go Developer Survey

cache

package
v1.20.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const NoExpiration time.Duration = 0

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application struct {
	cache.Driver
	// contains filtered or unexported fields
}

func NewApplication

func NewApplication(config config.Config, log log.Log, store string) (*Application, error)

func (*Application) Store

func (app *Application) Store(name string) cache.Driver

type Driver

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

func NewDriver

func NewDriver(config config.Config) *Driver

func (*Driver) New

func (d *Driver) New(store string) (cache.Driver, error)

type Lock

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

func NewLock

func NewLock(instance contractscache.Driver, key string, t ...time.Duration) *Lock

func (*Lock) Block

func (r *Lock) Block(t time.Duration, callback ...func()) bool

func (*Lock) BlockWithTicker

func (r *Lock) BlockWithTicker(t time.Duration, ti time.Duration, callback ...func()) bool

func (*Lock) ForceRelease

func (r *Lock) ForceRelease() bool

func (*Lock) Get

func (r *Lock) Get(callback ...func()) bool

func (*Lock) Release

func (r *Lock) Release() bool

type Memory

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

func NewMemory

func NewMemory(config config.Config) (*Memory, error)

func (*Memory) Add

func (r *Memory) Add(key string, value any, t time.Duration) bool

Add an item in the cache if the key does not exist.

func (*Memory) Decrement

func (r *Memory) Decrement(key string, value ...int64) (int64, error)

Decrement decrements the value of an item in the cache.

func (*Memory) Docker

func (r *Memory) Docker() (docker.CacheDriver, error)

func (*Memory) Flush

func (r *Memory) Flush() bool

Flush Remove all items from the cache. Clear in place: replacing the sync.Map would swap out the mutex held by concurrent readers.

func (*Memory) Forever

func (r *Memory) Forever(key string, value any) bool

Forever Put an item in the cache indefinitely.

func (*Memory) Forget

func (r *Memory) Forget(key string) bool

Forget Remove an item from the cache.

func (*Memory) Get

func (r *Memory) Get(key string, def ...any) any

Get Retrieve an item from the cache by key.

func (*Memory) GetBool

func (r *Memory) GetBool(key string, def ...bool) bool

func (*Memory) GetInt

func (r *Memory) GetInt(key string, def ...int) int

func (*Memory) GetInt64

func (r *Memory) GetInt64(key string, def ...int64) int64

func (*Memory) GetString

func (r *Memory) GetString(key string, def ...string) string

func (*Memory) Has

func (r *Memory) Has(key string) bool

Has Checks an item exists in the cache.

func (*Memory) Increment

func (r *Memory) Increment(key string, value ...int64) (int64, error)

func (*Memory) Lock

func (r *Memory) Lock(key string, t ...time.Duration) contractscache.Lock

func (*Memory) Pull

func (r *Memory) Pull(key string, def ...any) any

Pull Retrieve an item from the cache and delete it.

func (*Memory) Put

func (r *Memory) Put(key string, value any, t time.Duration) error

Put an item in the cache for a given number of seconds.

func (*Memory) Remember

func (r *Memory) Remember(key string, seconds time.Duration, callback func() (any, error)) (any, error)

Remember Get an item from the cache, or execute the given Closure and store the result.

func (*Memory) RememberForever

func (r *Memory) RememberForever(key string, callback func() (any, error)) (any, error)

RememberForever Get an item from the cache, or execute the given Closure and store the result forever.

func (*Memory) WithContext

func (r *Memory) WithContext(ctx context.Context) contractscache.Driver

type ServiceProvider

type ServiceProvider struct {
}

func (*ServiceProvider) Boot

func (r *ServiceProvider) Boot(app foundation.Application)

func (*ServiceProvider) Register

func (r *ServiceProvider) Register(app foundation.Application)

func (*ServiceProvider) Relationship

func (r *ServiceProvider) Relationship() binding.Relationship

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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