Documentation ¶
Index ¶
Constants ¶
const (
NotificationNamespaceChanges = "notifications.changes.namespace"
)
Constants for notification topics.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NamespacedCache ¶
type NamespacedCache struct {
// contains filtered or unexported fields
}
A NamespacedCache is used to cache namespaced information. The cache will invalidate all items when their namespace is deleted or updated.
func New ¶
func New(pubsub bahamut.PubSubClient, maxSize int64, options ...Option) *NamespacedCache
New returns a new namespace cache.
func (*NamespacedCache) Delete ¶
func (c *NamespacedCache) Delete(namespace string, key string) bool
Delete attempts to delete an item from the cache using the given namespace and key.
func (*NamespacedCache) Get ¶
func (c *NamespacedCache) Get(namespace string, key string) *ccache.Item
Get returns the cached item for the provided namespaced key.
func (*NamespacedCache) Set ¶
Set sets a new namespaced key with the given value, with given expiration. namespace must be set. key is optional. It can be empty if you wish to only associate one value to one namespace.
func (*NamespacedCache) Start ¶
func (c *NamespacedCache) Start(ctx context.Context)
Start starts listening to notifications for automatic invalidation
type Option ¶
type Option func(*config)
Option represents a parametric option for the nscache.
func OptionNotificationName ¶
OptionNotificationName allows to change the notification name used to listen to namespace changes from the pubsub. This defaults to NotificationNamespaceChanges,