MCPcopy Index your code
hub / github.com/simstudioai/sim / clearCache

Method clearCache

apps/sim/lib/mcp/service.ts:783–807  ·  view source on GitHub ↗
(workspaceId?: string)

Source from the content-addressed store, hash-verified

781 }
782
783 async clearCache(workspaceId?: string): Promise<void> {
784 try {
785 if (workspaceId) {
786 // No enabled/deletedAt filter so disabled and soft-deleted rows are
787 // cleared too. Hard-deleted rows are gone from the table; their keys
788 // expire via TTL.
789 const rows = await db
790 .select({ id: mcpServers.id })
791 .from(mcpServers)
792 .where(eq(mcpServers.workspaceId, workspaceId))
793 await Promise.allSettled(
794 rows.flatMap((r) => [
795 this.cacheAdapter.delete(serverCacheKey(workspaceId, r.id)),
796 this.cacheAdapter.delete(failureCacheKey(workspaceId, r.id)),
797 ])
798 )
799 logger.debug(`Cleared MCP tool cache for workspace ${workspaceId} (${rows.length} servers)`)
800 } else {
801 await this.cacheAdapter.clear()
802 logger.debug('Cleared all MCP tool cache')
803 }
804 } catch (error) {
805 logger.warn('Failed to clear cache:', error)
806 }
807 }
808}
809
810export const mcpService = new McpService()

Callers 6

archiveWorkspaceFunction · 0.80
service.test.tsFile · 0.80
performCreateMcpServerFunction · 0.80
performUpdateMcpServerFunction · 0.80
performDeleteMcpServerFunction · 0.80
route.tsFile · 0.80

Calls 7

serverCacheKeyFunction · 0.85
failureCacheKeyFunction · 0.85
debugMethod · 0.80
deleteMethod · 0.65
clearMethod · 0.65
warnMethod · 0.65
eqFunction · 0.50

Tested by

no test coverage detected