Documentation ¶
Index ¶
- type Cache
- func (c *Cache[T]) Add(e T)
- func (c *Cache[T]) AddDeletedListener(l ElementDeletedListener)
- func (c *Cache[T]) All(ctx context.Context) ([]T, error)
- func (c *Cache[T]) ElementCount(ctx context.Context) (int64, error)
- func (c *Cache[T]) ElementDeleted(ctx context.Context, e Element) (err error)
- func (c *Cache[T]) ElementWithID(ctx context.Context, id types.ID) (T, error)
- func (c *Cache[T]) ElementWithUniqueName(ctx context.Context, name string) (T, error)
- func (c *Cache[T]) ElementsWithName(ctx context.Context, name string) ([]T, error)
- func (c *Cache[T]) Remove(ctx context.Context, e T) (err error)
- func (c *Cache[T]) Reset()
- type Element
- type ElementDeletedListener
- type ElementUniqueNameGenerator
- type ListenableElement
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache[T Element] struct { // contains filtered or unexported fields }
Cache provides caching of containers or photos within a container so we do not need to do a HTTP request to lookup info every time we want info on an element.
func (*Cache[T]) Add ¶
func (c *Cache[T]) Add(e T)
Add may be called to add a element to the cache. This can be useful when a element is created
func (*Cache[T]) AddDeletedListener ¶
func (c *Cache[T]) AddDeletedListener(l ElementDeletedListener)
func (*Cache[T]) All ¶
All will return all elements
If all elements for this container are already in the cache then it will return directly from the cache. If not all elements are known then it will build the cache by asking for pages until it discovers a page that has no elements and then returns all elements in the cache.
func (*Cache[T]) ElementCount ¶
ElementCount will return the number of elements
func (*Cache[T]) ElementDeleted ¶
func (*Cache[T]) ElementWithID ¶
get the element with the specified ID. In the event that there is no element with the specified ID a nil Photo is returned
func (*Cache[T]) ElementWithUniqueName ¶
func (*Cache[T]) ElementsWithName ¶
get elements with a specific name. In the event that there are no elements with the specified name nil is returned
type ElementDeletedListener ¶
type ListenableElement ¶
type ListenableElement interface { Element AddDeletedListener(l ElementDeletedListener) }