Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:1broseidon Ketch cache ShowTag TagList

From Leeroopedia
Knowledge Sources
Domains Caching, Tagging
Last Updated 2026-10-27 00:00 GMT

Overview

Reads the durable tag index: `ShowTag` returns the newest entries under one tag (default 50, 0 for all) with cache-warmth status; `TagList` summarizes every tag with its entry count.

Description

ShowTag returns a `TagView` with `TaggedPage{URL, Title, Description, TaggedAt, Cached}` entries sorted newest-first (TaggedAt desc, URL asc tiebreak). `limit` defaults to `DefaultTagLimit=50`; `0` returns all. `CacheStatus` is `"available"` when the page cache can be checked and `"unavailable"` when it can't, so callers distinguish "not cached" from "can't tell". TagList returns `[]TagSummary{Tag, Count}` for every tag.

Usage

Backs `ketch tag show`, `ketch tag list`, the MCP `tag` tool's show/list operations, and `ketch cache`'s tag stats.

Code Reference

Source Location

  • Repository: ketch
  • File: cache/tags.go

Signature

const DefaultTagLimit = 50

type TaggedPage struct {
	URL         string
	Title       string
	Description string
	TaggedAt    int64
	Cached      bool
}

type TagView struct {
	Tag         string
	Entries     int
	Shown       int
	Cached      int
	CacheStatus string // "available" or "unavailable"
	Pages       []TaggedPage
}

type TagSummary struct {
	Tag   string
	Count int
}

// ShowTag returns the newest entries under tag (limit=0 returns all).
func (c *Cache) ShowTag(tag string, limit int) (TagView, error)

// TagList summarizes every tag with its entry count.
func (c *Cache) TagList() ([]TagSummary, error)

Import

import "github.com/1broseidon/ketch/cache"

I/O Contract

Inputs (ShowTag)

Name Type Required Description
tag string Yes Validated tag name
limit int Yes Newest entries to return; 0 returns all

Outputs

Name Type Description
return TagView Entries + shown/cached totals + cache_status
return error error Validation failure

Usage Examples

Show Newest 50

view, err := tags.ShowTag("docs", 50) // default; 0 returns all
for _, p := range view.Pages {
	fmt.Printf("%s\t%s\t%s\t%d\n", p.URL, p.Title, p.Description, p.Cached)
}
fmt.Printf("cache_status: %s\n", view.CacheStatus)

List Every Tag

summaries, err := tags.TagList()
for _, s := range summaries {
	fmt.Printf("%s\t%d\n", s.Tag, s.Count)
}

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment