Documentation ¶
Overview ¶
Package cache implements Swx GRPC response cache
Index ¶
- Constants
- type Impl
- func (swxCache *Impl) ClearAll()
- func (swxCache *Impl) Gc(interval, ttl time.Duration) chan struct{}
- func (swxCache *Impl) Get(imsi string) *protos.AuthenticationAnswer
- func (swxCache *Impl) Put(ans *protos.AuthenticationAnswer) *protos.AuthenticationAnswer
- func (swxCache *Impl) Remove(imsi string) *protos.AuthenticationAnswer
Constants ¶
View Source
const ( // defaultTtl - cached entity TTL after last recent use DefaultTtl = time.Hour * 3 // defaultGcInterval - frequency of Garbage Collection checks DefaultGcInterval = time.Minute * 5 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Impl ¶
type Impl struct {
// contains filtered or unexported fields
}
func (*Impl) ClearAll ¶
func (swxCache *Impl) ClearAll()
ClearAll removes all cached entities & re-initializes the cache
func (*Impl) Gc ¶
Gc starts Garbage Collector with specified check interval & TTL. Returns chan to stop the GC: done := cache.Gc(interval, ttl); ... done <- struct{}{}; ...
func (*Impl) Get ¶
func (swxCache *Impl) Get(imsi string) *protos.AuthenticationAnswer
Get retrieves one auth vector from cache if available, adjusts cache and returns the vector, returns nil otherwise
func (*Impl) Put ¶
func (swxCache *Impl) Put(ans *protos.AuthenticationAnswer) *protos.AuthenticationAnswer
Put adds ans vectors into the cache after extracting the first vector from the list, which it returns back to the caller in the returned AuthenticationAnswer
Click to show internal directories.
Click to hide internal directories.