storage

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const RingCapacity int32 = 100

Variables

View Source
var ErrDeviceNotFound = errors.New("device not found")
View Source
var ErrDeviceParamsNotFound = errors.New("device params not found")
View Source
var ErrGisNotFound = errors.New("gis not found")
View Source
var ErrSessionClosed = errors.New("session closed")

Functions

func CacheSegment added in v0.3.2

func CacheSegment(seg *model.Segment) bool

func ClearSession

func ClearSession(id string)

清理session

func GetSession

func GetSession(id string) (*model.Session, error)

通过id获取session。如果不存在,返回ErrSessionClosed(正常情况不会出现关闭session后还来获取session)

func StoreSession

func StoreSession(s *model.Session)

缓存session

Types

type DeviceCache

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

func GetDeviceCache

func GetDeviceCache() *DeviceCache

func (*DeviceCache) CacheDevice

func (cache *DeviceCache) CacheDevice(d *model.Device)

func (*DeviceCache) DelDeviceByCarPlate

func (cache *DeviceCache) DelDeviceByCarPlate(carPlate string)

func (*DeviceCache) DelDeviceByPhone

func (cache *DeviceCache) DelDeviceByPhone(phone string)

func (*DeviceCache) GetDeviceByPhone

func (cache *DeviceCache) GetDeviceByPhone(phone string) (*model.Device, error)

func (*DeviceCache) GetDeviceByPlate

func (cache *DeviceCache) GetDeviceByPlate(carPlate string) (*model.Device, error)

func (*DeviceCache) HasPhone

func (cache *DeviceCache) HasPhone(phone string) bool

func (*DeviceCache) HasPlate

func (cache *DeviceCache) HasPlate(carPlate string) bool

func (*DeviceCache) ListDevice

func (cache *DeviceCache) ListDevice() []*model.Device

type DeviceParamsCache

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

func GetDeviceParamsCache

func GetDeviceParamsCache() *DeviceParamsCache

func (*DeviceParamsCache) CacheDeviceParams

func (cache *DeviceParamsCache) CacheDeviceParams(d *model.DeviceParams)

func (*DeviceParamsCache) DelDeviceParamsByPhone

func (cache *DeviceParamsCache) DelDeviceParamsByPhone(phone string)

func (*DeviceParamsCache) GetDeviceParamsByPhone

func (cache *DeviceParamsCache) GetDeviceParamsByPhone(phone string) (*model.DeviceParams, error)

type GeoCache

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

func GetGeoCache

func GetGeoCache() *GeoCache

func (*GeoCache) DelGeoByPhone

func (cache *GeoCache) DelGeoByPhone(phone string)

func (*GeoCache) GetGeoLatestByPhone

func (cache *GeoCache) GetGeoLatestByPhone(phone string) (*model.DeviceGeo, error)

func (*GeoCache) GetGeoRingByPhone

func (cache *GeoCache) GetGeoRingByPhone(phone string) *container.RingBuffer

type SegmentCache added in v0.3.2

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

type SessionCache

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

Jump to

Keyboard shortcuts

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