coolcache

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: LGPL-2.1 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// For use with functions that take an expiration time.
	NoExpiration time.Duration = -1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CoolCache

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

func NewCoolCache

func NewCoolCache(shardNumber int, defaultExpiration, cleanupInterval time.Duration) *CoolCache

func (*CoolCache) Get

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

Get an item from the cache. Returns the item or nil, and a bool indicating whether the key was found.

func (*CoolCache) Set

func (c *CoolCache) Set(key string, value interface{}, d time.Duration)

Add an item to the cache, replacing any existing item. If the duration is 0 (DefaultExpiration), the cache's default expiration time is used. If it is -1 (NoExpiration), the item never expires.

func (*CoolCache) Sum64

func (c *CoolCache) Sum64(key string) uint64

Jump to

Keyboard shortcuts

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