cache

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CacheDirPerm is the permission for the cache directory (0700 = rwx------)
	// Restrictive permissions protect the directory from being accessed by other users
	CacheDirPerm os.FileMode = 0700
	// CacheFilePerm is the permission for cache files (0600 = rw-------)
	// Restrictive permissions protect cached content from being read by other users
	CacheFilePerm os.FileMode = 0600
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

func New

func New(ttlDays int) (*Cache, error)

func (*Cache) Get

func (c *Cache) Get(hash string) string

func (*Cache) Hash

func (c *Cache) Hash(text string) string

func (*Cache) Set

func (c *Cache) Set(hash, original, corrected string) error

type CacheEntry

type CacheEntry struct {
	Hash      string `json:"hash"`
	Original  string `json:"original"`
	Corrected string `json:"corrected"`
	Timestamp int64  `json:"timestamp"`
}

Jump to

Keyboard shortcuts

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