2025-02-25 10:01:12 +08:00

48 lines
1.1 KiB
TypeScript

import { UserApp, clearAllUserApp } from '../module/get-user-app.ts';
import { redis } from '../module/redis/redis.ts';
import path from 'path';
import { config, fileStore } from '../module/config.ts';
const main = async () => {
const userApp = new UserApp({ user: 'root', app: 'codeflow' });
const res = await userApp.setCacheData();
console.log(res);
// userApp.close();
process.exit(0);
};
// main();
const getAll = async () => {
const userApp = new UserApp({ user: 'root', app: 'codeflow' });
const res = await userApp.getAllCacheData();
userApp.close();
};
// getAll();
// console.log('path', path.join(filePath, '/module/get-user-app.ts'));
const clearData = async () => {
const userApp = new UserApp({ user: 'root', app: 'codeflow' });
const res = await userApp.clearCacheData();
process.exit(0);
};
// clearData();
// clearAllUserApp();
const expireData = async () => {
await redis.set('user:app:exist:' + 'codeflow:root', 'value', 'EX', 2);
process.exit(0);
};
// expireData();
const keysData = async () => {
const keys = await redis.keys('user:app:exist:*');
console.log('keys', keys);
process.exit(0);
};
keysData();