|
1 | 1 | // deno-lint-ignore-file no-explicit-any |
2 | 2 | import JsonViewer from "../components/JsonViewer.tsx"; |
3 | 3 | import { RequestContext } from "../deco.ts"; |
4 | | -import { ValueType, weakcache } from "../deps.ts"; |
| 4 | +import { ValueType } from "../deps.ts"; |
5 | 5 | import type { Block, BlockModule, InstanceOf } from "../engine/block.ts"; |
6 | 6 | import { FieldResolver } from "../engine/core/resolver.ts"; |
7 | 7 | import { singleFlight } from "../engine/core/utils.ts"; |
@@ -117,11 +117,6 @@ export const wrapCaughtErrors = async < |
117 | 117 | } |
118 | 118 | }; |
119 | 119 |
|
120 | | -export const LOADER_CACHE_START_TRESHOLD = |
121 | | - Deno.env.get("LOADER_CACHE_START_TRESHOLD") ?? 0; |
122 | | - |
123 | | -export const LOADER_CACHE_SIZE = Deno.env.get("LOADER_CACHE_SIZE") ?? 1_024_000; |
124 | | - |
125 | 120 | const stats = { |
126 | 121 | cache: meter.createCounter("loader_cache", { |
127 | 122 | unit: "1", |
@@ -154,8 +149,6 @@ const inFuture = (maybeDate: string) => { |
154 | 149 |
|
155 | 150 | const noop = () => ""; |
156 | 151 |
|
157 | | -let countCache = null as (weakcache.WeakLRUCache<any, any> | null); |
158 | | - |
159 | 152 | /** |
160 | 153 | * Wraps the loader written by the user by adding support for: |
161 | 154 | * 1. Caching |
@@ -229,28 +222,6 @@ const wrapLoader = ( |
229 | 222 | ctx.vary?.push(loader, cacheKeyValue); |
230 | 223 | RequestContext?.signal?.throwIfAborted(); |
231 | 224 |
|
232 | | - if (countCache === null) { |
233 | | - countCache = new weakcache.WeakLRUCache({ |
234 | | - cacheSize: +LOADER_CACHE_SIZE, |
235 | | - }); |
236 | | - } |
237 | | - |
238 | | - const cc = countCache.getValue(cacheKeyValue) ?? { count: 0 }; |
239 | | - |
240 | | - if (cc.count === 0) { |
241 | | - cc.count = 1; |
242 | | - countCache.setValue(cacheKeyValue, cc); |
243 | | - } else { |
244 | | - cc.count += 1; |
245 | | - } |
246 | | - |
247 | | - if (cc.count < LOADER_CACHE_START_TRESHOLD) { |
248 | | - status = "bypass"; |
249 | | - stats.cache.add(1, { status, loader }); |
250 | | - |
251 | | - return await handler(props, req, ctx); |
252 | | - } |
253 | | - |
254 | 225 | const cache = maybeCache; |
255 | 226 |
|
256 | 227 | const timing = ctx.monitoring?.timings.start("loader-hash"); |
|
0 commit comments