cache

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMemoryCache added in v1.0.12

func NewMemoryCache(prefix string) cache.Store

func NewRedisCache added in v1.0.12

func NewRedisCache() cache.Store

Types

type Application

type Application struct {
	Store  cache.Store
	Prefix string
}

func (*Application) Init

func (app *Application) Init() cache.Store

type Memory added in v1.0.12

type Memory struct {
	Prefix string
	Client contractStorage.Storage
}

func (*Memory) Add added in v1.0.12

func (r *Memory) Add(key string, value interface{}, seconds time.Duration) bool

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

func (*Memory) Flush added in v1.0.12

func (r *Memory) Flush() bool

Flush Remove all items from the cache.

func (*Memory) Forever added in v1.0.12

func (r *Memory) Forever(key string, value interface{}) bool

Forever Store an item in the cache indefinitely.

func (*Memory) Forget added in v1.0.12

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

Forget Remove an item from the cache.

func (*Memory) Get added in v1.0.12

func (r *Memory) Get(key string, def interface{}) interface{}

Get Retrieve an item from the cache by key.

func (*Memory) GetBool added in v1.0.12

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

func (*Memory) GetInt added in v1.0.12

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

func (*Memory) GetString added in v1.0.12

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

func (*Memory) Has added in v1.0.12

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

Has Check an item exists in the cache.

func (*Memory) Pull added in v1.0.12

func (r *Memory) Pull(key string, def interface{}) interface{}

Pull Retrieve an item from the cache and delete it.

func (*Memory) Put added in v1.0.12

func (r *Memory) Put(key string, value interface{}, seconds time.Duration) error

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

func (*Memory) Remember added in v1.0.12

func (r *Memory) Remember(key string, ttl time.Duration, callback func() interface{}) (interface{}, error)

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

func (*Memory) RememberForever added in v1.0.12

func (r *Memory) RememberForever(key string, callback func() interface{}) (interface{}, error)

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

type Redis

type Redis struct {
	Prefix string
	Redis  *redis.Client
}

func (*Redis) Add

func (r *Redis) Add(key string, value interface{}, seconds time.Duration) bool

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

func (*Redis) Flush

func (r *Redis) Flush() bool

Flush Remove all items from the cache.

func (*Redis) Forever

func (r *Redis) Forever(key string, value interface{}) bool

Forever Store an item in the cache indefinitely.

func (*Redis) Forget

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

Forget Remove an item from the cache.

func (*Redis) Get

func (r *Redis) Get(key string, def interface{}) interface{}

Get Retrieve an item from the cache by key.

func (*Redis) GetBool added in v1.0.3

func (r *Redis) GetBool(key string, def bool) bool

func (*Redis) GetInt added in v1.0.3

func (r *Redis) GetInt(key string, def int) int

func (*Redis) GetString added in v1.0.3

func (r *Redis) GetString(key string, def string) string

func (*Redis) Has

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

Has Check an item exists in the cache.

func (*Redis) Pull

func (r *Redis) Pull(key string, def interface{}) interface{}

Pull Retrieve an item from the cache and delete it.

func (*Redis) Put

func (r *Redis) Put(key string, value interface{}, seconds time.Duration) error

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

func (*Redis) Remember

func (r *Redis) Remember(key string, ttl time.Duration, callback func() interface{}) (interface{}, error)

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

func (*Redis) RememberForever

func (r *Redis) RememberForever(key string, callback func() interface{}) (interface{}, error)

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

type ServiceProvider

type ServiceProvider struct {
	Store cache.Store
}

func (*ServiceProvider) Boot

func (database *ServiceProvider) Boot()

func (*ServiceProvider) Register

func (database *ServiceProvider) Register()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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