dict

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

缓存 todo 以后增加关闭项目缓存数据,启动时候加载进来

用slice做简单队列

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNil = errors.New("nil or type error")
)

Functions

func Float64

func Float64(reply interface{}, err error) (float64, error)

func Int

func Int(reply interface{}, err error) (int, error)

func Int64

func Int64(reply interface{}, err error) (int64, error)

func String

func String(reply interface{}, err error) (string, error)

Types

type CacheItem

type CacheItem struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*CacheItem) AddTime

func (p *CacheItem) AddTime() time.Time

func (*CacheItem) Data

func (p *CacheItem) Data() interface{}

func (*CacheItem) Expired

func (p *CacheItem) Expired() bool

func (*CacheItem) Key

func (p *CacheItem) Key() interface{}

func (*CacheItem) Life

func (p *CacheItem) Life() time.Duration

type CacheTable

type CacheTable struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func Cache

func Cache(table string) *CacheTable

func (*CacheTable) Add

func (p *CacheTable) Add(k, v interface{}, l ...int) *CacheItem

func (*CacheTable) Count

func (p *CacheTable) Count(k interface{}) int

func (*CacheTable) Delete

func (p *CacheTable) Delete(k interface{}) (*CacheItem, error)

func (*CacheTable) Exists

func (p *CacheTable) Exists(k interface{}) bool

func (*CacheTable) Float64

func (p *CacheTable) Float64(reply interface{}, err error) (float64, error)

func (*CacheTable) Get

func (p *CacheTable) Get(k interface{}) (interface{}, error)

func (*CacheTable) Int

func (p *CacheTable) Int(reply interface{}, err error) (int, error)

func (*CacheTable) Int64

func (p *CacheTable) Int64(reply interface{}, err error) (int64, error)

func (*CacheTable) Item

func (p *CacheTable) Item(k interface{}) *CacheItem

func (*CacheTable) Items

func (p *CacheTable) Items() map[interface{}]*CacheItem

func (*CacheTable) Set

func (p *CacheTable) Set(k, v interface{}, l ...int) *CacheItem

func (*CacheTable) String

func (p *CacheTable) String(reply interface{}, err error) (string, error)

type SimpleQueue

type SimpleQueue struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewSimpleQueue

func NewSimpleQueue(initSize int) *SimpleQueue

func (*SimpleQueue) Count

func (p *SimpleQueue) Count() int

func (*SimpleQueue) Front

func (p *SimpleQueue) Front() (interface{}, error)

从头取数据

func (*SimpleQueue) Insert

func (p *SimpleQueue) Insert(v interface{}) error

func (*SimpleQueue) Last

func (p *SimpleQueue) Last() (interface{}, error)

从结尾取数据

Jump to

Keyboard shortcuts

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