import request from '@/utils/request';
// 查询缓存列表
export function listCache(query: any) {
	return request({
		url: '/api/core/runtime/cache',
		method: 'get',
		params: query,
	});
}

// 删除缓存
export function delCache(query: any) {
	/*
	{
		path:[
			'/test1/function.js',
			'/test2/function.js,
		]
	}
	*/
	const newQuery = Array.isArray(query) ? query : [query];
	return request({
		method: 'delete',
		// url: `/call/runtime/cache/remove?path=${query}`,
		url: `/api/core/runtime/cache`,
		params: {
			path: newQuery,
		},
	});
}

// 删除所有缓存
export function delCacheAll() {
	return request({
		method: 'delete',
		url: `/api/core/runtime/cache`,
		params: {
			path: ['*'],
		},
	});
}
