Skip to main content
Glama

https://github.com/sammcj/mcp-package-version

by sammcj
package cache import ( "sync" "time" ) // Cache provides a simple in-memory cache with expiration type Cache struct { data map[string]interface{} times map[string]time.Time ttl time.Duration mu sync.RWMutex } // NewCache creates a new cache with the specified TTL func NewCache(ttl time.Duration) *Cache { return &Cache{ data: make(map[string]interface{}), times: make(map[string]time.Time), ttl: ttl, } } // Get retrieves a value from the cache func (c *Cache) Get(key string) (interface{}, bool) { c.mu.RLock() defer c.mu.RUnlock() val, exists := c.data[key] if !exists { return nil, false } // Check if expired if time.Since(c.times[key]) > c.ttl { return nil, false } return val, true } // Set stores a value in the cache func (c *Cache) Set(key string, val interface{}) { c.mu.Lock() defer c.mu.Unlock() c.data[key] = val c.times[key] = time.Now() }

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/sammcj/mcp-package-version'

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