cache

package module
v0.0.0-...-ed519ab Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2019 License: GPL-3.0 Imports: 2 Imported by: 0

README

cache

Motivation

​ Sometimes we need a cache library binding our service, so that to reach a target which once our service dead, cache data is invalid too or not exist.

​ There are some cache in the market, like as redis, memcache, groupcache and so on. certainly the other embed key value database , like as boltdb, rocksdb, leveldb, etc. they aren't satisfy with the below features.

​ So I create this new cache, welcome to use.

if it can help you, please star this repository, thanks

Features

  • ​ No need for persistent caching
  • ​ Support range query based on key value
  • ​ Performance represents not bad
  • ​ As part of the service

Documentation

Overview

Copyright © 2019 Mobius <sv0220@163.com>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Get(key string) ([]byte, error)
	Match(prefix string) ([]*Value, error)
	GetKeys() ([]string, error)
	Set(key string, value []byte) error
	Del(key string) error
	Clear() error
}

func NewCache

func NewCache(maxBytes int) Cache

type Value

type Value struct {
	Key string
	Val []byte
}

Directories

Path Synopsis
inspire from - https://godoc.org/golang.org/x/text/internal/triegen.
inspire from - https://godoc.org/golang.org/x/text/internal/triegen.

Jump to

Keyboard shortcuts

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