All files / src/lib/api-docs/endpoints/admin cache.ts

100% Statements 43/43
100% Branches 0/0
100% Functions 0/0
100% Lines 43/43

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 441x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
/**
 * Admin Cache Endpoints
 * Cache management and statistics
 */
 
import type { ApiEndpoint } from '@/types/api-docs';
 
export const adminCacheEndpoints: ApiEndpoint[] = [
  {
    id: 'admin-cache-stats',
    method: 'GET',
    path: '/api/admin/cache/stats',
    summary: 'Get cache statistics',
    description: 'Returns cache hit/miss statistics and memory usage',
    category: 'admin-cache',
    requiresAuth: true,
    adminOnly: true,
    responses: [
      { status: 200, description: 'Cache statistics', example: { success: true, data: { hits: 15000, misses: 500, hitRate: 96.8, memoryUsage: '25MB' } } },
    ],
  },
  {
    id: 'admin-cache-invalidate',
    method: 'POST',
    path: '/api/admin/cache/invalidate',
    summary: 'Invalidate cache',
    description: 'Invalidates cache entries by pattern or key',
    category: 'admin-cache',
    requiresAuth: true,
    adminOnly: true,
    requestBody: {
      contentType: 'application/json',
      fields: [
        { name: 'pattern', type: 'string', required: false, description: 'Cache key pattern to invalidate' },
        { name: 'keys', type: 'array', required: false, description: 'Specific cache keys to invalidate' },
        { name: 'all', type: 'boolean', required: false, description: 'Invalidate all cache entries' },
      ],
    },
    responses: [
      { status: 200, description: 'Cache invalidated', example: { success: true, data: { invalidated: 25 } } },
    ],
  },
];