store

package
v1.9.5 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EntityCache

type EntityCache interface {
	//Gets the entity.
	GetEntity(freedom.Entity) error
	//Delete the entity.
	Delete(result freedom.Entity, async ...bool) error
	//Set up the data source.
	SetSource(func(freedom.Entity) error) EntityCache
	//Set the prefix for cache KEY.
	SetPrefix(string) EntityCache
	//Set the time of life, The default is 5 minutes.
	SetExpiration(time.Duration) EntityCache
	// Turn asynchronous writes on or off
	// The default is to close.
	// Cache misses read the database.
	SetAsyncWrite(bool) EntityCache
	//Turn off redis and only request memory takes effect.
	CloseRedis() EntityCache
}

EntityCache The entity cache component. The first and second level caches are implemented. The first-level cache uses the requested memory. Can prevent breakdown.

type EntityCacheImpl

type EntityCacheImpl struct {
	freedom.Infra
	// contains filtered or unexported fields
}

EntityCacheImpl .

func (*EntityCacheImpl) BeginRequest

func (cache *EntityCacheImpl) BeginRequest(worker freedom.Worker)

BeginRequest Polymorphic method, subclasses can override overrides overrides. The request is triggered after entry.

func (*EntityCacheImpl) CloseRedis

func (cache *EntityCacheImpl) CloseRedis() EntityCache

CloseRedis Turn off redis and only request memory takes effect.

func (*EntityCacheImpl) Delete

func (cache *EntityCacheImpl) Delete(result freedom.Entity, async ...bool) error

Delete the entity.

func (*EntityCacheImpl) GetEntity

func (cache *EntityCacheImpl) GetEntity(result freedom.Entity) error

GetEntity Gets the entity.

func (*EntityCacheImpl) SetAsyncWrite

func (cache *EntityCacheImpl) SetAsyncWrite(open bool) EntityCache

SetAsyncWrite . Turn asynchronous writes on or off The default is to close. Cache misses read the database.

func (*EntityCacheImpl) SetExpiration

func (cache *EntityCacheImpl) SetExpiration(expiration time.Duration) EntityCache

SetExpiration Set the time of life, The default is 5 minutes.

func (*EntityCacheImpl) SetPrefix

func (cache *EntityCacheImpl) SetPrefix(prefix string) EntityCache

SetPrefix Set the prefix for cache KEY.

func (*EntityCacheImpl) SetSource

func (cache *EntityCacheImpl) SetSource(call func(result freedom.Entity) error) EntityCache

SetSource Set up the data source.

Jump to

Keyboard shortcuts

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