perf(core): replace md5 cache key with xxhash64 (#13974)
* perf(core): replace md5 cache key with xxhash64 * test: add test case for cache TTL key
This commit is contained in:
@@ -13,7 +13,7 @@ beforeAll(() => {
|
||||
afterEach(() => {
|
||||
delete process.env.CACHE_TYPE;
|
||||
jest.resetModules();
|
||||
server.close();
|
||||
server?.close();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
@@ -203,4 +203,17 @@ describe('cache', () => {
|
||||
expect(e.message).toContain('Cache key must be a string');
|
||||
}
|
||||
});
|
||||
|
||||
it('throws TTL key', async () => {
|
||||
process.env.CACHE_TYPE = 'redis';
|
||||
const app = require('../../lib/app');
|
||||
|
||||
try {
|
||||
await app.context.cache.get('rsshub:cacheTtl:mock');
|
||||
} catch (e) {
|
||||
expect(e.message).toContain('reserved for the internal usage');
|
||||
} finally {
|
||||
await app.context.cache.clients.redisClient.quit();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user