"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.metadata=void 0;const cache_1=require("@b/utils/cache");exports.metadata={summary:"Clear settings cache",description:"Clears the Redis cache and reloads all settings from the database",operationId:"clearSettingsCache",tags:["Admin","Settings","Cache"],requiresAuth:!0,permission:"edit.settings",responses:{200:{description:"Cache cleared successfully",content:{"application/json":{schema:{type:"object",properties:{success:{type:"boolean"},message:{type:"string"},settingsCount:{type:"number"},extensionsCount:{type:"number"}}}}}},401:{description:"Unauthorized"},500:{description:"Internal server error"}}};exports.default=async e=>{var s,t,a;const{ctx:n}=e;try{null===(s=null==n?void 0:n.step)||void 0===s||s.call(n,"Clearing settings cache");const e=cache_1.CacheManager.getInstance();await e.clearCache();const a=await e.getSettings(),c=await e.getExtensions();null===(t=null==n?void 0:n.success)||void 0===t||t.call(n,`Cache cleared. Loaded ${a.size} settings, ${c.size} extensions`);return{success:!0,message:"Cache cleared and reloaded from database",settingsCount:a.size,extensionsCount:c.size}}catch(e){null===(a=null==n?void 0:n.fail)||void 0===a||a.call(n,e.message);throw e}};