Skip to content

Instantly share code, notes, and snippets.

View hiepxanh's full-sized avatar

hiepxanh hiepxanh

View GitHub Profile
@kgajera
kgajera / server.ts
Created May 25, 2020 22:44
Angular Express Server with Redis Caching
import 'zone.js/dist/zone-node';
import { APP_BASE_HREF } from '@angular/common';
import { ngExpressEngine } from '@nguniversal/express-engine';
import * as express from 'express';
import { existsSync } from 'fs';
import { join } from 'path';
import * as redis from 'redis';
import { AppServerModule } from './src/main.server';
@hanishi
hanishi / index.tsx
Last active March 7, 2024 03:36
AutocompleteServer for ChatGPT
type CacheEntry<T> = {
value: T,
timeout: ReturnType<typeof setTimeout>,
}
class ExpiringCache<T> {
private readonly cache: Record<string, CacheEntry<T>>;
private readonly expirationTime: number;
constructor(expirationTime: number = 5000) {