feat: completely remove redis
This commit is contained in:
@ -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)
|
||||
) {
|
||||
|
Reference in New Issue
Block a user