Skip to content

The micro-VM for AI agents — light enough to embed on your laptop, elastic enough to power an agentic cloud.

1.5 KB
Raw Blame
/*
 * Copyright Daytona Platforms Inc.
 * SPDX-License-Identifier: AGPL-3.0
 */

export const BOX_LOOKUP_CACHE_TTL_MS = 10_000
export const BOX_ORG_ID_CACHE_TTL_MS = 60_000

type BoxLookupCacheKeyArgs = {
  organizationId?: string | null
  returnDestroyed?: boolean
}

export function boxLookupCacheKeyById(args: BoxLookupCacheKeyArgs & { id: string }): string {
  const organizationId = args.organizationId ?? 'none'
  const returnDestroyed = args.returnDestroyed ? 1 : 0
  return `box:lookup:by-id:org:${organizationId}:returnDestroyed:${returnDestroyed}:value:${args.id}`
}

export function boxLookupCacheKeyByName(args: BoxLookupCacheKeyArgs & { boxName: string }): string {
  const organizationId = args.organizationId ?? 'none'
  const returnDestroyed = args.returnDestroyed ? 1 : 0
  return `box:lookup:by-name:org:${organizationId}:returnDestroyed:${returnDestroyed}:value:${args.boxName}`
}

export function boxLookupCacheKeyByAuthToken(args: { authToken: string }): string {
  return `box:lookup:by-authToken:${args.authToken}`
}

type BoxOrgIdCacheKeyArgs = {
  organizationId?: string
}

export function boxOrgIdCacheKeyById(args: BoxOrgIdCacheKeyArgs & { id: string }): string {
  const organizationId = args.organizationId ?? 'none'
  return `box:orgId:by-id:org:${organizationId}:value:${args.id}`
}

export function boxOrgIdCacheKeyByName(args: BoxOrgIdCacheKeyArgs & { boxName: string }): string {
  const organizationId = args.organizationId ?? 'none'
  return `box:orgId:by-name:org:${organizationId}:value:${args.boxName}`
}