Documentation
¶
Index ¶
- type Cache
- type CachedSearchService
- type CachedTicketService
- func (s *CachedTicketService) Create(ctx context.Context, req *types.CreateTicketRequest) (*types.Ticket, error)
- func (s *CachedTicketService) Delete(ctx context.Context, id int64) error
- func (s *CachedTicketService) Get(ctx context.Context, id int64, opts *types.GetTicketOptions) (*types.TicketResult, error)
- func (s *CachedTicketService) List(ctx context.Context, opts *types.ListTicketsOptions) (*types.TicketPage, error)
- func (s *CachedTicketService) ListAudits(ctx context.Context, ticketID int64, opts *types.ListAuditsOptions) (*types.AuditPage, error)
- func (s *CachedTicketService) ListComments(ctx context.Context, ticketID int64, opts *types.ListCommentsOptions) (*types.CommentPage, error)
- func (s *CachedTicketService) Update(ctx context.Context, id int64, req *types.UpdateTicketRequest) (*types.Ticket, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is a simple in-memory TTL cache with prefix-based invalidation.
func (*Cache) Get ¶
Get returns the cached value for key if it exists and has not expired. Expired entries are lazily deleted.
func (*Cache) Invalidate ¶
Invalidate removes all entries whose keys start with any of the given prefixes.
type CachedSearchService ¶
type CachedSearchService struct {
// contains filtered or unexported fields
}
CachedSearchService wraps a zendesk.SearchService with a TTL cache. It shares a Cache instance with CachedTicketService so ticket mutations also invalidate search results.
func NewCachedSearchService ¶
func NewCachedSearchService(delegate zendesk.SearchService, c *Cache) *CachedSearchService
NewCachedSearchService creates a caching decorator around the given SearchService.
func (*CachedSearchService) Search ¶
func (s *CachedSearchService) Search(ctx context.Context, query string, opts *types.SearchOptions) (*types.SearchPage, error)
type CachedTicketService ¶
type CachedTicketService struct {
// contains filtered or unexported fields
}
CachedTicketService wraps a zendesk.TicketService with a TTL cache. Read operations check the cache first; mutations pass through and invalidate.
func NewCachedTicketService ¶
func NewCachedTicketService(delegate zendesk.TicketService, c *Cache) *CachedTicketService
NewCachedTicketService creates a caching decorator around the given TicketService. The provided Cache instance should be shared with CachedSearchService so that ticket mutations also invalidate search results.
func (*CachedTicketService) Create ¶
func (s *CachedTicketService) Create(ctx context.Context, req *types.CreateTicketRequest) (*types.Ticket, error)
func (*CachedTicketService) Delete ¶
func (s *CachedTicketService) Delete(ctx context.Context, id int64) error
func (*CachedTicketService) Get ¶
func (s *CachedTicketService) Get(ctx context.Context, id int64, opts *types.GetTicketOptions) (*types.TicketResult, error)
func (*CachedTicketService) List ¶
func (s *CachedTicketService) List(ctx context.Context, opts *types.ListTicketsOptions) (*types.TicketPage, error)
func (*CachedTicketService) ListAudits ¶
func (s *CachedTicketService) ListAudits(ctx context.Context, ticketID int64, opts *types.ListAuditsOptions) (*types.AuditPage, error)
func (*CachedTicketService) ListComments ¶
func (s *CachedTicketService) ListComments(ctx context.Context, ticketID int64, opts *types.ListCommentsOptions) (*types.CommentPage, error)