faviconcache

package
v0.11.6-beta.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2025 License: Apache-2.0 Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFavicon

func GetFavicon(urlStr string) string

--- GetFavicon ---

GetFavicon takes a URL string and returns a base64-encoded src URL for an <img> tag. If the favicon is already in cache and “fresh,” it returns it immediately. Otherwise it kicks off a background fetch (if one isn’t already in progress) and returns whatever is in the cache (which may be empty).

func SetInCache

func SetInCache(key string, item FaviconCacheItem)

Types

type FaviconCacheItem

type FaviconCacheItem struct {
	// Data is the base64-encoded data URL string (e.g. "data:image/png;base64,...")
	Data string
	// LastFetched is when this entry was last updated.
	LastFetched time.Time
}

FaviconCacheItem represents one cached favicon entry.

func GetFromCache

func GetFromCache(key string) (FaviconCacheItem, bool)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL