UNPKG

expeditavoluptas

Version:

TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.

16 lines (11 loc) 502 B
import { MemoryCacheAdapter } from '@mikro-orm/core'; describe('MemoryCacheAdapter', () => { test('should ignore old cache', async () => { const cache = new MemoryCacheAdapter({ expiration: 10 }); await cache.set('cache-test-handle-1', 123, ''); await expect(cache.get('cache-test-handle-1')).resolves.toBe(123); await new Promise(resolve => setTimeout(resolve, 20)); await expect(cache.get('cache-test-handle-1')).resolves.toBeUndefined(); await cache.clear(); }); });