github.com/kalandramo/bald/cache v0.1.1
Go module source archive layoutArchive contains go.mod
SHA-256cc4d1fd547c62c8b560873320dea29e12c16a69b191f282b8de32f206a44688b
MaleculeMd(Pa₃)
Evidence
1package cache
2
3import (
4 "context"
5 "errors"
6 "testing"
7 "time"
8)
9
10func TestErrNotFound(t *testing.T) {
11 if !errors.Is(ErrNotFound, ErrNotFound) {
12 t.Error("ErrNotFound should match itself via errors.Is")
13 }
14 if ErrNotFound.Error() == "" {
15 t.Error("ErrNotFound should have a non-empty message")
16 }
17}
⋯6 lines
32:49… .Second)
33 }
34}
35
36// dummyCache is a minimal Cache for interface verification.
37type dummyCache struct{}
38
39func (dummyCache) Get(context.Context, string …
51:55… { return nil }
52
53var _ Cache = dummyCache{}
54
55func TestCacheInterface(t *testing.T) {
56 var c Cache = dummyCache{}
57 ctx := context.Background()
58
59 val, err := c.G …
1// Package cache defines the caching abstraction for the bald framework.
2//
3// It provides a minimal, backend-agnostic interface for key-value caching
4// with TTL support. Concrete implementations (in-memory, Redis, etc.)
5// implement this interface so that business code depends only on the contract.
6package cache
7
8import (
9 "context"
10 "errors"
11 "time"
12)
13
14// ErrNotFound indicates that the requested key was not found in the cache.
15var ErrNotFoun …
26:5… ll operations accept a context for cancellation and timeout control.
27// Implementations must be safe for concurrent use.
28type Cache interface {
29 // …
No evidence locations were recorded for this file. Raw result