MCPcopy
hub / github.com/TanStack/ai / createMapStorage

Function createMapStorage

packages/ai/tests/tool-cache-middleware.test.ts:509–523  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

507
508 describe('custom storage', () => {
509 function createMapStorage(): ToolCacheStorage & {
510 store: Map<string, ToolCacheEntry>
511 } {
512 const store = new Map<string, ToolCacheEntry>()
513 return {
514 store,
515 getItem: (key) => store.get(key),
516 setItem: (key, value) => {
517 store.set(key, value)
518 },
519 deleteItem: (key) => {
520 store.delete(key)
521 },
522 }
523 }
524
525 it('should use custom storage for cache hits', async () => {
526 let callCount = 0

Callers 1

Calls 3

getMethod · 0.65
setMethod · 0.65
deleteMethod · 0.65

Tested by

no test coverage detected