@lcap/asl
Version:
NetEase Application Specific Language
32 lines (30 loc) • 780 B
text/typescript
import webFileService from '../../service/webFile';
/**
* 生成上次修改的缓存
* @param serviceId
* @param path
*/
export function saveLastModified(serviceId: string, path?: string) {
return webFileService.saveFile({
body: {
serviceId,
type: 'last-modified',
path: 'lastModified.json',
content: JSON.stringify({ timestamp: new Date().toJSON(), path }),
},
});
}
/**
* 加载上次修改的缓存
* @param serviceId
* @param path
*/
export async function loadLastModified(serviceId: string) {
const result = await webFileService.loadFile({
query: {
serviceId,
path: 'lastModified.json',
},
});
return result && JSON.parse(result.content);
}