Skip to main content
Glama
cache.go627 B
package service import ( "sync" "github.com/dgraph-io/ristretto/v2" ) var cache *ristretto.Cache[string, any] var once sync.Once type cacheService struct { } func CacheService() *cacheService { once.Do(func() { if c, err := ristretto.NewCache(&ristretto.Config[string, any]{ NumCounters: 1e7, // number of keys to track frequency of (10M). MaxCost: 1 << 30, // maximum cost of cache (1GB). BufferItems: 64, // number of keys per Get buffer. }); err == nil { cache = c } }) return &cacheService{} } func (c *cacheService) CacheInstance() *ristretto.Cache[string, any] { return cache }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/weibaohui/k8m'

If you have feedback or need assistance with the MCP directory API, please join our Discord server