Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheOption ¶
type CacheOption func(c *InMemoryCache)
CacheOption provides configuration options for the in memory cache.
func WithSecondsBetweenCleanUps ¶
func WithSecondsBetweenCleanUps(seconds uint) CacheOption
WithSecondsBetweenCleanUps configuration option for seconds between clean ups.
func WithTTL ¶
func WithTTL(seconds uint) CacheOption
WithTTL configuration option for time to live key values.
type DTO ¶
type DTO struct {
Key int64
DomainModel DomainModel // cannot be nil
Data []byte
}
DTO as data transfer object brings together the application layers and the cache.
func NewDTO ¶
func NewDTO(domain DomainModel, data []byte) *DTO
type InMemoryCache ¶
type InMemoryCache struct {
// contains filtered or unexported fields
}
InMemoryCache contains cached domain model data.
func NewCache ¶
func NewCache(ctx context.Context, domain DomainModel, config ...CacheOption) *InMemoryCache
NewCache is constructor for in memory cache.
func (*InMemoryCache) Close ¶
func (c *InMemoryCache) Close()
func (*InMemoryCache) Delete ¶
func (c *InMemoryCache) Delete(key int64) error
func (*InMemoryCache) Get ¶
func (c *InMemoryCache) Get(key int64) (*DTO, error)
Get returns a DTO if it finds one for the passed key. defer not used due to the performance penalty
func (*InMemoryCache) Set ¶
func (c *InMemoryCache) Set(dto *DTO) error
Click to show internal directories.
Click to hide internal directories.