dao

package
v0.0.0-...-6882831 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCacheMissed       = errors.New("cache missed")
	ErrNoAvailablePerson = errors.New("no available selectedPersons in DB")
)

Functions

This section is empty.

Types

type InferDao

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

func NewInferDao

func NewInferDao(formats resource.FileFormats) *InferDao

func (*InferDao) Close

func (in *InferDao) Close()

func (*InferDao) SetInferRes

func (in *InferDao) SetInferRes(ctx *kernel.RequestContext, data []byte, rkgPersons []*face_rkg.RecognizedPerson)

type PersonDao

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

func NewPersonDao

func NewPersonDao(formats resource.FileFormats) *PersonDao

func (*PersonDao) Close

func (pd *PersonDao) Close()

func (*PersonDao) LoadPersons

func (pd *PersonDao) LoadPersons(ctx context.Context) error

LoadPersons pulls the person data, consisting of three main steps:

(1) pull all the pids from redis to get the pids that are not in the local cache.

(2) the local cache data will be returned directly if all the pid local caches are available

(3) otherwise, pull the data corresponding to the new pid from redis. if there are all new pid data in Redis, update the local cache and return data otherwise, pull the new pid data that is not in Redis from MySQL, update Redis as well as local cache, and return data.

func (*PersonDao) Person

func (pd *PersonDao) Person(ctx context.Context, id int) (db.Person, error)

func (*PersonDao) Range

func (pd *PersonDao) Range(rangeFunc func(k string, v db.Person))

Jump to

Keyboard shortcuts

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