1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/kelvins-io-g2cache

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
interface.go 1.3 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
cristiane Отправлено 25.06.2021 04:22 2852ba1
package g2cache
// Local memory cache,Local memory cache with high access speed
type LocalCache interface {
Get(key string, obj interface{}) (*Entry, bool, error) // obj represents the internal structure of the real object
Set(key string, e *Entry) error // local storage should set Entry.Obsolete
Del(key string) error
ThreadSafe() // Need to ensure thread safety
Close()
}
// External cache has faster access speed, such as Redis
type OutCache interface {
Get(key string, obj interface{}) (*Entry, bool, error) // obj represents the internal structure of the real object
Set(key string, e *Entry) error // out storage should set Entry.Expiration
Del(key string) error
ThreadSafe() // Need to ensure thread safety
Close()
}
// only out storage pub sub
type PubSub interface {
Subscribe(data chan<- *ChannelMeta) error
Publish(gid, key string, action int8, data *Entry) error
}
// Shouldn't throw a panic, please return an error
type LoadDataSourceFunc func() (interface{}, error)
// Entry expire is UnixNano
const (
SetPublishType int8 = iota
DelPublishType
)
type ChannelMeta struct {
Key string `json:"key"` // cache key
Gid string `json:"gid"` // Used to identify working groups
Action int8 `json:"action"` // SetPublishType,DelPublishType
Data *Entry `json:"data"`
}

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/kelvins-io-g2cache.git
git@api.gitlife.ru:oschina-mirror/kelvins-io-g2cache.git
oschina-mirror
kelvins-io-g2cache
kelvins-io-g2cache
release