MCPcopy Index your code
hub / github.com/NdoleStudio/httpsms / PhoneRistrettoCache

Method PhoneRistrettoCache

api/pkg/di/container.go:1761–1776  ·  view source on GitHub ↗

PhoneRistrettoCache creates an in-memory *ristretto.Cache[string, *entities.Phone]

()

Source from the content-addressed store, hash-verified

1759
1760// PhoneRistrettoCache creates an in-memory *ristretto.Cache[string, *entities.Phone]
1761func (container *Container) PhoneRistrettoCache() *ristretto.Cache[string, *entities.Phone] {
1762 if container.phoneRistrettoCache != nil {
1763 return container.phoneRistrettoCache
1764 }
1765 container.logger.Debug(fmt.Sprintf("creating %T", container.phoneRistrettoCache))
1766 ristrettoCache, err := ristretto.NewCache[string, *entities.Phone](&ristretto.Config[string, *entities.Phone]{
1767 MaxCost: 5000,
1768 NumCounters: 5000 * 10,
1769 BufferItems: 64,
1770 })
1771 if err != nil {
1772 container.logger.Fatal(stacktrace.Propagate(err, "cannot create phone ristretto cache"))
1773 }
1774 container.phoneRistrettoCache = ristrettoCache
1775 return container.phoneRistrettoCache
1776}
1777
1778// UserRistrettoCache creates an in-memory *ristretto.Cache[string, entities.AuthContext]
1779func (container *Container) UserRistrettoCache() *ristretto.Cache[string, entities.AuthContext] {

Callers 1

PhoneRepositoryMethod · 0.95

Calls 2

DebugMethod · 0.65
FatalMethod · 0.65

Tested by

no test coverage detected