cache

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: Apache-2.0, EPL-2.0 Imports: 3 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

Cache is a system used structure for the goals of caching.

func NewTTLCache

func NewTTLCache() *Cache

NewTTLCache creates cache data for the TTL usage.

func (*Cache) Close

func (c *Cache) Close()

Close is used to close the cache.

func (*Cache) First

func (c *Cache) First() (interface{}, bool)

First removes the first element.

func (*Cache) Get

func (c *Cache) Get(key string) (interface{}, bool)

Get finds and returns the element mapped with the provided key if available.

func (*Cache) Put

func (c *Cache) Put(key string, value interface{}, ttl time.Duration) bool

Put adds element with the provided key.

func (*Cache) Remove

func (c *Cache) Remove(key string) bool

Remove removes the element with the provided key and returns true is present.

func (*Cache) Size

func (c *Cache) Size() int

Size returns the elements size.

Jump to

Keyboard shortcuts

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