cache

package
v0.0.0-...-1272ae6 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2020 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

使用方法:

查看cache_test.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ICache

type ICache interface {
	KeyName() string
	PrimaryKey(model interface{}) string
	GetAll() (data interface{}, err error)
}

ICache ICache

type MemCache

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

MemCache MemCache

func NewMemCache

func NewMemCache() *MemCache

NewMemCache NewMemCache

func (*MemCache) ClearAll

func (m *MemCache) ClearAll()

ClearAll ClearAll

func (*MemCache) Get

func (m *MemCache) Get(key string) (data interface{}, isExist bool)

Get get data by string key

func (*MemCache) GetAll

func (m *MemCache) GetAll(obj ICache) (data interface{}, err error)

GetAll GetAll

func (*MemCache) GetItem

func (m *MemCache) GetItem(obj ICache, id int64) (item interface{}, err error)

GetItem 取[]data中的一项数据

func (*MemCache) Set

func (m *MemCache) Set(key string, data interface{})

Set Set

type Prov

type Prov struct {
	ID   int64
	Name string
}

demo model

func (*Prov) GetAllData

func (m *Prov) GetAllData() (data []*Prov, err error)

from mysql or other...

type ProvCache

type ProvCache struct{}

接口实现

func (*ProvCache) GetAll

func (m *ProvCache) GetAll() (data interface{}, err error)

func (*ProvCache) KeyName

func (m *ProvCache) KeyName() string

KeyName KeyName

func (*ProvCache) PrimaryKey

func (m *ProvCache) PrimaryKey(obj interface{}) string

PrimaryKey PrimaryKey

Jump to

Keyboard shortcuts

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