Documentation ¶
Overview ¶
Package cache contains caching structures using internally by the Fleetspeak server.
Index ¶
- Variables
- type Clients
- func (c *Clients) Clear()
- func (c *Clients) Get(id common.ClientID) *db.ClientData
- func (c *Clients) GetOrRead(ctx context.Context, id common.ClientID, db db.ClientStore) (data *db.ClientData, hit bool, err error)
- func (c *Clients) Size() int
- func (c *Clients) Stop()
- func (c *Clients) Update(id common.ClientID, data *db.ClientData)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // MaxAge defines how long client data should be considered valid // for. Variable to support unit testing. MaxAge = 45 * time.Second )
Functions ¶
This section is empty.
Types ¶
type Clients ¶
type Clients struct {
// contains filtered or unexported fields
}
Clients is a cache of recently connected clients.
func (*Clients) Get ¶
func (c *Clients) Get(id common.ClientID) *db.ClientData
Get returns the cached client data, if there is sufficiently fresh data in the cache, otherwise nil.
func (*Clients) GetOrRead ¶
func (c *Clients) GetOrRead(ctx context.Context, id common.ClientID, db db.ClientStore) (data *db.ClientData, hit bool, err error)
GetOrRead returns the cached client data, if there is sufficiently fresh data in the cache. Otherwise it attempts to read the data from the provided datastore. It returns data if it finds any, hit if it was found in the cache.
func (*Clients) Size ¶
Size returns the current size taken up by the cache, this is a count of client records, some of which may no longer be up to date.
Click to show internal directories.
Click to hide internal directories.