kvcache

package module
v0.0.0-...-231a8ef Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2019 License: Apache-2.0 Imports: 3 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

KVcache

simple key/value storage engine with atomic operation

Documentation

Overview

Package kvcache provide a atomic cache surport

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bucket

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

Bucket defined a container to this cache engine

func NewBucket

func NewBucket() *Bucket

NewBucket defined a function to create a new container of this cache engine

func (*Bucket) Delete

func (b *Bucket) Delete(keys ...string) int

Delete delete objects in array keys

func (*Bucket) Get

func (b *Bucket) Get(key string, objCacher ObjectCacher) error

Get use key to find object in Bucket

func (*Bucket) GetObject

func (b *Bucket) GetObject(key string) (obj interface{}, err error)

GetObject use key to find object in Bucket and return it without deserialize

func (*Bucket) Keys

func (b *Bucket) Keys() []string

Keys return array of all keys in the Bucket

func (*Bucket) Set

func (b *Bucket) Set(key string, objCacher ObjectCacher) error

Set storage a object to Bucket

func (*Bucket) SetObject

func (b *Bucket) SetObject(key string, obj interface{}) error

SetObject storage a object direct to Bucket

type ObjectCacher

type ObjectCacher interface {
	Serialize() (obj string, err error)
	Deserialize(obj string) (err error)
}

ObjectCacher defined a interface to this cache engine

Jump to

Keyboard shortcuts

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