Skip to main content
Glama
cache.test.ts994 B
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors // SPDX-License-Identifier: Apache-2.0 import { LRUCache } from './cache'; describe('Cache', () => { test('LRU', () => { const cache = new LRUCache<string>(3); // Create cache with capacity of 3 cache.set('a', 'a'); cache.set('b', 'b'); cache.set('c', 'c'); cache.set('d', 'd'); expect(cache.get('a')).toBeUndefined(); expect(cache.get('b')).toStrictEqual('b'); expect(cache.get('c')).toStrictEqual('c'); expect(cache.get('d')).toStrictEqual('d'); }); test('Reordering', () => { const cache = new LRUCache<string>(3); // Create cache with capacity of 3 cache.set('a', 'a'); cache.set('b', 'b'); cache.set('c', 'c'); cache.get('a'); cache.set('d', 'd'); expect(cache.get('a')).toStrictEqual('a'); expect(cache.get('b')).toBeUndefined(); expect(cache.get('c')).toStrictEqual('c'); expect(cache.get('d')).toStrictEqual('d'); }); });

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/medplum/medplum'

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