feat: completely remove redis

This commit is contained in:
2025-01-06 16:14:29 +01:00
parent d3009ac315
commit 53c4d5b129
24 changed files with 629 additions and 311 deletions

View File

@ -1,7 +1,7 @@
import { FreshContext, Handlers } from "$fresh/server.ts";
import { getMovie } from "@lib/tmdb.ts";
import * as cache from "@lib/cache/cache.ts";
import { json } from "@lib/helpers.ts";
import { createCache } from "@lib/cache.ts";
type CachedMovieCredits = {
lastUpdated: number;
@ -9,6 +9,7 @@ type CachedMovieCredits = {
};
const CACHE_INTERVAL = 1000 * 60 * 24 * 30;
const cache = createCache<CachedMovieCredits>({ expires: CACHE_INTERVAL });
const GET = async (
_req: Request,
@ -24,7 +25,7 @@ const GET = async (
const cacheId = `/movie/${id}`;
const cachedResponse = await cache.get<CachedMovieCredits>(cacheId);
const cachedResponse = cache.get(cacheId);
if (
cachedResponse && Date.now() < (cachedResponse.lastUpdated + CACHE_INTERVAL)
) {