cache

package
v1.13.9 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const Binding = "goravel.cache"
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 added in v1.11.0

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

func (*Application) Store added in v1.11.0

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

type Driver added in v1.12.0

type Driver interface {
	New(store string) (cache.Driver, error)
}

type DriverImpl added in v1.12.0

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

func NewDriverImpl added in v1.12.0

func NewDriverImpl(config config.Config) *DriverImpl

func (*DriverImpl) New added in v1.12.0

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

type Lock added in v1.11.0

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

func NewLock added in v1.11.0

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

func (*Lock) Block added in v1.11.0

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

func (*Lock) ForceRelease added in v1.11.0

func (r *Lock) ForceRelease() bool

func (*Lock) Get added in v1.11.0

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

func (*Lock) Release added in v1.11.0

func (r *Lock) Release() bool

type Memory added in v1.9.0

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

func NewMemory added in v1.9.0

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

func (*Memory) Add added in v1.9.0

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

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

func (*Memory) Decrement added in v1.11.0

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

func (*Memory) Flush added in v1.9.0

func (r *Memory) Flush() bool

Flush Remove all items from the cache.

func (*Memory) Forever added in v1.9.0

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

Forever Driver an item in the cache indefinitely.

func (*Memory) Forget added in v1.9.0

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

Forget Remove an item from the cache.

func (*Memory) Get added in v1.9.0

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

Get Retrieve an item from the cache by key.

func (*Memory) GetBool added in v1.9.0

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

func (*Memory) GetInt added in v1.9.0

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

func (*Memory) GetInt64 added in v1.11.0

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

func (*Memory) GetString added in v1.9.0

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

func (*Memory) Has added in v1.9.0

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

Has Check an item exists in the cache.

func (*Memory) Increment added in v1.11.0

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

func (*Memory) Lock added in v1.11.0

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

func (*Memory) Pull added in v1.9.0

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

Pull Retrieve an item from the cache and delete it.

func (*Memory) Put added in v1.9.0

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

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

func (*Memory) Remember added in v1.9.0

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 added in v1.9.0

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 added in v1.9.0

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

type ServiceProvider

type ServiceProvider struct {
}

func (*ServiceProvider) Boot

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

func (*ServiceProvider) Register

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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