zzcache

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2020 License: MIT Imports: 8 Imported by: 0

README

zzcache

Yet another cache library

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CRC32

type CRC32 struct {
}

CRC32 provides implementation of using golang crc32 algorithm

func (*CRC32) Do

func (c *CRC32) Do(b []byte) uint32

Do returns CRC32 checksum

type Cache

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

Cache defines app objects

func New

func New(size uint32, storeType string) (*Cache, error)

New creates app

func (*Cache) Delete

func (c *Cache) Delete(key []byte) error

Delete provides deletetign data from the cache

func (*Cache) Get

func (c *Cache) Get(key []byte) ([]byte, error)

Get provides getting data from the cache

func (*Cache) Set

func (c *Cache) Set(key, value []byte, d time.Duration) error

Set provides inserting to the cache

type Hasher

type Hasher interface {
	Do([]byte) uint32
}

Hasher provides implementation of the hash function

type Map

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

func (*Map) Delete

func (m *Map) Delete(key string) error

func (*Map) Get

func (m *Map) Get(key string) ([]byte, error)

func (*Map) Set

func (m *Map) Set(key string, value []byte) error

type Radix

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

func (*Radix) Delete

func (r *Radix) Delete(key string) error

func (*Radix) Get

func (r *Radix) Get(key string) ([]byte, error)

func (*Radix) Set

func (r *Radix) Set(key string, value []byte) error

type Store

type Store interface {
	Set(key string, value []byte) error
	Get(key string) ([]byte, error)
	Delete(key string) error
}

func NewMap

func NewMap() Store

func NewRadix

func NewRadix() Store

Jump to

Keyboard shortcuts

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