cache

package
v0.0.0-...-a39819d Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2016 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash

func Hash(data string) uint64

Types

type Bucket

type Bucket interface {
	//Store key value in bucket
	Set(kv store.KeyValue)

	//Returns key value from bucket. Return nil if key does not exist
	Get(key string) (store.KeyValue, bool)

	//Cleanup deletes all the expired key values
	Cleanup()

	//Save the entiries to file
	Save(path string) (string, error)

	//Load the entries from file
	Load(fileName string) (bool, error)
}

Bucket interface provides API to acess bucket

type Cache

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

Cache holds buckets

func NewCache

func NewCache(noOfBuckets int) *Cache

func (*Cache) Cleanup

func (c *Cache) Cleanup()

func (*Cache) Get

func (c *Cache) Get(key string) (string, error)

func (*Cache) GetBit

func (c *Cache) GetBit(key string, offset int) uint8

func (*Cache) Load

func (c *Cache) Load(fileName string) (string, error)

func (*Cache) Save

func (c *Cache) Save(fileName string) (string, error)

func (*Cache) Set

func (c *Cache) Set(input SetInput) error

func (*Cache) SetBit

func (c *Cache) SetBit(key string, offset, value int) (uint8, error)

func (*Cache) ZAdd

func (c *Cache) ZAdd(input ZSetInput) (int, error)

func (*Cache) ZCard

func (c *Cache) ZCard(key string) (int, error)

func (*Cache) ZCount

func (c *Cache) ZCount(key, min, max string) (int, error)

func (*Cache) ZRange

func (c *Cache) ZRange(key string, start, stop int) ([]store.ScoreMember, error)

type SetInput

type SetInput struct {
	Key    string
	Value  string
	Expiry time.Duration
	NX     bool
	XX     bool
}

Input holds all the args passed to Set API

type ZSetInput

type ZSetInput struct {
	Key    string
	Scores []store.ScoreMember
	NX     bool
	XX     bool
	CH     bool
	INCR   bool
}

Input holds all the args passed to Set API

Jump to

Keyboard shortcuts

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