cache

package
v0.0.0-...-bc28a72 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

This package holds the implementations for the project cache interface

Index

Constants

This section is empty.

Variables

View Source
var File_cache_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type CachedChannel

type CachedChannel struct {
	Name       string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	CreatedAt  int64  `protobuf:"varint,2,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
	IsClosed   bool   `protobuf:"varint,3,opt,name=isClosed,proto3" json:"isClosed,omitempty"`
	Extra      string `protobuf:"bytes,4,opt,name=extra,proto3" json:"extra,omitempty"`
	Persistent bool   `protobuf:"varint,5,opt,name=persistent,proto3" json:"persistent,omitempty"`
	Private    bool   `protobuf:"varint,6,opt,name=private,proto3" json:"private,omitempty"`
	Presence   bool   `protobuf:"varint,7,opt,name=presence,proto3" json:"presence,omitempty"`
	Push       bool   `protobuf:"varint,8,opt,name=push,proto3" json:"push,omitempty"`
	// contains filtered or unexported fields
}

func (*CachedChannel) Descriptor deprecated

func (*CachedChannel) Descriptor() ([]byte, []int)

Deprecated: Use CachedChannel.ProtoReflect.Descriptor instead.

func (*CachedChannel) GetCreatedAt

func (x *CachedChannel) GetCreatedAt() int64

func (*CachedChannel) GetExtra

func (x *CachedChannel) GetExtra() string

func (*CachedChannel) GetIsClosed

func (x *CachedChannel) GetIsClosed() bool

func (*CachedChannel) GetName

func (x *CachedChannel) GetName() string

func (*CachedChannel) GetPersistent

func (x *CachedChannel) GetPersistent() bool

func (*CachedChannel) GetPresence

func (x *CachedChannel) GetPresence() bool

func (*CachedChannel) GetPrivate

func (x *CachedChannel) GetPrivate() bool

func (*CachedChannel) GetPush

func (x *CachedChannel) GetPush() bool

func (*CachedChannel) ProtoMessage

func (*CachedChannel) ProtoMessage()

func (*CachedChannel) ProtoReflect

func (x *CachedChannel) ProtoReflect() protoreflect.Message

func (*CachedChannel) Reset

func (x *CachedChannel) Reset()

func (*CachedChannel) String

func (x *CachedChannel) String() string

type CachedChannelEvent

type CachedChannelEvent struct {
	SenderID  string `protobuf:"bytes,1,opt,name=senderID,proto3" json:"senderID,omitempty"`
	EventType string `protobuf:"bytes,2,opt,name=eventType,proto3" json:"eventType,omitempty"`
	Payload   string `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"`
	Timestamp int64  `protobuf:"varint,5,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	// contains filtered or unexported fields
}

func (*CachedChannelEvent) Descriptor deprecated

func (*CachedChannelEvent) Descriptor() ([]byte, []int)

Deprecated: Use CachedChannelEvent.ProtoReflect.Descriptor instead.

func (*CachedChannelEvent) GetEventType

func (x *CachedChannelEvent) GetEventType() string

func (*CachedChannelEvent) GetPayload

func (x *CachedChannelEvent) GetPayload() string

func (*CachedChannelEvent) GetSenderID

func (x *CachedChannelEvent) GetSenderID() string

func (*CachedChannelEvent) GetTimestamp

func (x *CachedChannelEvent) GetTimestamp() int64

func (*CachedChannelEvent) ProtoMessage

func (*CachedChannelEvent) ProtoMessage()

func (*CachedChannelEvent) ProtoReflect

func (x *CachedChannelEvent) ProtoReflect() protoreflect.Message

func (*CachedChannelEvent) Reset

func (x *CachedChannelEvent) Reset()

func (*CachedChannelEvent) String

func (x *CachedChannelEvent) String() string

type CachedClient

type CachedClient struct {
	Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
	Extra    string `protobuf:"bytes,2,opt,name=extra,proto3" json:"extra,omitempty"`
	// contains filtered or unexported fields
}

func (*CachedClient) Descriptor deprecated

func (*CachedClient) Descriptor() ([]byte, []int)

Deprecated: Use CachedClient.ProtoReflect.Descriptor instead.

func (*CachedClient) GetExtra

func (x *CachedClient) GetExtra() string

func (*CachedClient) GetUsername

func (x *CachedClient) GetUsername() string

func (*CachedClient) ProtoMessage

func (*CachedClient) ProtoMessage()

func (*CachedClient) ProtoReflect

func (x *CachedClient) ProtoReflect() protoreflect.Message

func (*CachedClient) Reset

func (x *CachedClient) Reset()

func (*CachedClient) String

func (x *CachedClient) String() string

type CachedDevice

type CachedDevice struct {
	Id    string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"`
	// contains filtered or unexported fields
}

func (*CachedDevice) Descriptor deprecated

func (*CachedDevice) Descriptor() ([]byte, []int)

Deprecated: Use CachedDevice.ProtoReflect.Descriptor instead.

func (*CachedDevice) GetId

func (x *CachedDevice) GetId() string

func (*CachedDevice) GetToken

func (x *CachedDevice) GetToken() string

func (*CachedDevice) ProtoMessage

func (*CachedDevice) ProtoMessage()

func (*CachedDevice) ProtoReflect

func (x *CachedDevice) ProtoReflect() protoreflect.Message

func (*CachedDevice) Reset

func (x *CachedDevice) Reset()

func (*CachedDevice) String

func (x *CachedDevice) String() string

type LedisCacheStorage

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

LedisCacheStorage - Cache implementation in Ledis

func NewLedisCacheStorage

func NewLedisCacheStorage() *LedisCacheStorage

NewLedisCacheStorage - Create a new ledis cache instance

func (*LedisCacheStorage) AddClientChannel

func (cache *LedisCacheStorage) AddClientChannel(clientID string, channelID string)

AddClientChannel - Add a new channel to client channels cache

func (*LedisCacheStorage) AddClientChannels

func (cache *LedisCacheStorage) AddClientChannels(clientID string, channelIDs []string)

AddClientChannels - Store list of channels client can access in cache

func (*LedisCacheStorage) AddDevice

func (cache *LedisCacheStorage) AddDevice(clientID string, device *core.Device)

AddDevice - Add device to user list

func (*LedisCacheStorage) CheckChannelExistence

func (cache *LedisCacheStorage) CheckChannelExistence(appID string, channelID string) bool

CheckChannelExistence - Check if there is channel in cache

func (*LedisCacheStorage) CheckClientExistence

func (cache *LedisCacheStorage) CheckClientExistence(appID string, clientID string) bool

CheckClientExistence - Check if there is a client in cache

func (*LedisCacheStorage) CheckDeviceExistence

func (cache *LedisCacheStorage) CheckDeviceExistence(clientID string, id string) bool

CheckDeviceExistence - Check if device exists in cache

func (*LedisCacheStorage) GetApp

func (cache *LedisCacheStorage) GetApp(appID string) *core.App

GetApp - Get app from cache

func (*LedisCacheStorage) GetChannel

func (cache *LedisCacheStorage) GetChannel(appID string, channelID string) *core.Channel

GetChannel - Get channel from cache

func (*LedisCacheStorage) GetChannelEvents

func (cache *LedisCacheStorage) GetChannelEvents(channelID string, appID string, amount int64) []*core.ChannelEvent

GetChannelEvents - Get given cached events from the channel queue

func (*LedisCacheStorage) GetChannelEventsSize

func (cache *LedisCacheStorage) GetChannelEventsSize(channelID string, appID string) uint64

GetChannelEventsSize - Get how much events are stored in cache

func (*LedisCacheStorage) GetClient

func (cache *LedisCacheStorage) GetClient(appID string, clientID string) *core.Client

GetClient - Attempt to get client from cache

func (*LedisCacheStorage) GetClientChannels

func (cache *LedisCacheStorage) GetClientChannels(clientID string) ([]string, bool)

GetClientChannels - Get channels client can access from cache

func (*LedisCacheStorage) GetClientDevices

func (cache *LedisCacheStorage) GetClientDevices(clientID string) []*core.Device

GetClientDevices - Get all client devices

func (*LedisCacheStorage) GetDB

func (cache *LedisCacheStorage) GetDB() *ledis.DB

func (*LedisCacheStorage) GetOldestChannelEvent

func (cache *LedisCacheStorage) GetOldestChannelEvent(channelID string, appID string) *core.ChannelEvent

GetOldestChannelEvent - Get oldest event that is stored in cache

func (*LedisCacheStorage) RemoveApp

func (cache *LedisCacheStorage) RemoveApp(appID string)

RemoveApp - Remove app from cache

func (*LedisCacheStorage) RemoveChannel

func (cache *LedisCacheStorage) RemoveChannel(appID string, channelID string)

RemoveChannel - Remove channel from cache

func (*LedisCacheStorage) RemoveClient

func (cache *LedisCacheStorage) RemoveClient(appID string, clientID string)

RemoveClient - Remove client from cache

func (*LedisCacheStorage) RemoveClientChannel

func (cache *LedisCacheStorage) RemoveClientChannel(clientID string, channelID string)

RemoveClientChannel - Remove a channel from client channels cache

func (*LedisCacheStorage) RemoveClientChannels

func (cache *LedisCacheStorage) RemoveClientChannels(clientID string)

RemoveClientChannels - Remove client channels from cache

func (*LedisCacheStorage) RemoveDevice

func (cache *LedisCacheStorage) RemoveDevice(clientID string, id string)

RemoveDevice - Remove device from user list

func (*LedisCacheStorage) StoreApp

func (cache *LedisCacheStorage) StoreApp(appID string, name string)

StoreApp - Set app in cache

func (*LedisCacheStorage) StoreChannel

func (cache *LedisCacheStorage) StoreChannel(appID string, channelID string, channel *core.Channel)

StoreChannel - Store channel in cache

func (*LedisCacheStorage) StoreChannelEvent

func (cache *LedisCacheStorage) StoreChannelEvent(channelID string, appID string, event *core.ChannelEvent)

StoreChannelEvent - Store channel event on the beginning of the channel queue

func (*LedisCacheStorage) StoreClient

func (cache *LedisCacheStorage) StoreClient(appID string, clientID string, client *core.Client)

StoreClient - Cache client

type RedisCacheStorage

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

RedisCacheStorage - Cache implementation in Redis

func NewRedisCacheStorage

func NewRedisCacheStorage() *RedisCacheStorage

NewRedisCacheStorage - Create a new Redis cache instance

func (*RedisCacheStorage) AddClientChannel

func (cache *RedisCacheStorage) AddClientChannel(clientID string, channelID string)

AddClientChannel - Add a new channel to client channels cache

func (*RedisCacheStorage) AddClientChannels

func (cache *RedisCacheStorage) AddClientChannels(clientID string, channelIDs []string)

AddClientChannels - Store list of channels client can access in cache

func (*RedisCacheStorage) AddDevice

func (cache *RedisCacheStorage) AddDevice(clientID string, device *core.Device)

AddDevice - Add device to user list

func (*RedisCacheStorage) CheckChannelExistence

func (cache *RedisCacheStorage) CheckChannelExistence(appID string, channelID string) bool

CheckChannelExistence - Check if there is channel in cache

func (*RedisCacheStorage) CheckClientExistence

func (cache *RedisCacheStorage) CheckClientExistence(appID string, clientID string) bool

CheckClientExistence - Check if there is a client in cache

func (*RedisCacheStorage) CheckDeviceExistence

func (cache *RedisCacheStorage) CheckDeviceExistence(clientID string, id string) bool

CheckDeviceExistence - Check if device exists in cache

func (*RedisCacheStorage) GetApp

func (cache *RedisCacheStorage) GetApp(appID string) *core.App

GetApp - Get app from cache

func (*RedisCacheStorage) GetChannel

func (cache *RedisCacheStorage) GetChannel(appID string, channelID string) *core.Channel

GetChannel - Get channel from cache

func (*RedisCacheStorage) GetChannelEvents

func (cache *RedisCacheStorage) GetChannelEvents(channelID string, appID string, amount int64) []*core.ChannelEvent

GetChannelEvents - Get given cached events from the channel queue

func (*RedisCacheStorage) GetChannelEventsSize

func (cache *RedisCacheStorage) GetChannelEventsSize(channelID string, appID string) uint64

GetChannelEventsSize - Get how much events are stored in cache

func (*RedisCacheStorage) GetClient

func (cache *RedisCacheStorage) GetClient(appID string, clientID string) *core.Client

GetClient - Attempt to get client from cache

func (*RedisCacheStorage) GetClientChannels

func (cache *RedisCacheStorage) GetClientChannels(clientID string) ([]string, bool)

GetClientChannels - Get channels client can access from cache

func (*RedisCacheStorage) GetClientDevices

func (cache *RedisCacheStorage) GetClientDevices(clientID string) []*core.Device

GetClientDevices - Get all client devices

func (*RedisCacheStorage) GetOldestChannelEvent

func (cache *RedisCacheStorage) GetOldestChannelEvent(channelID string, appID string) *core.ChannelEvent

GetOldestChannelEvent - Get oldest event that is stored in cache

func (*RedisCacheStorage) RemoveApp

func (cache *RedisCacheStorage) RemoveApp(appID string)

RemoveApp - Remove app from cache

func (*RedisCacheStorage) RemoveChannel

func (cache *RedisCacheStorage) RemoveChannel(appID string, channelID string)

RemoveChannel - Remove channel from cache

func (*RedisCacheStorage) RemoveClient

func (cache *RedisCacheStorage) RemoveClient(appID string, clientID string)

RemoveClient - Remove client from cache

func (*RedisCacheStorage) RemoveClientChannel

func (cache *RedisCacheStorage) RemoveClientChannel(clientID string, channelID string)

RemoveClientChannel - Remove a channel from client channels cache

func (*RedisCacheStorage) RemoveClientChannels

func (cache *RedisCacheStorage) RemoveClientChannels(clientID string)

RemoveClientChannels - Remove client channels from cache

func (*RedisCacheStorage) RemoveDevice

func (cache *RedisCacheStorage) RemoveDevice(clientID string, id string)

RemoveDevice - Remove device from user list

func (*RedisCacheStorage) StoreApp

func (cache *RedisCacheStorage) StoreApp(appID string, name string)

StoreApp - Set app in cache

func (*RedisCacheStorage) StoreChannel

func (cache *RedisCacheStorage) StoreChannel(appID string, channelID string, channel *core.Channel)

StoreChannel - Store channel in cache

func (*RedisCacheStorage) StoreChannelEvent

func (cache *RedisCacheStorage) StoreChannelEvent(channelID string, appID string, event *core.ChannelEvent)

StoreChannelEvent - Store channel event on the beginning of the channel queue

func (*RedisCacheStorage) StoreClient

func (cache *RedisCacheStorage) StoreClient(appID string, clientID string, client *core.Client)

StoreClient - Cache client

Jump to

Keyboard shortcuts

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