deno_runtime/code_cache.rs
1// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
2
3use deno_core::ModuleSpecifier;
4
5#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
6pub enum CodeCacheType {
7 EsModule,
8 Script,
9}
10
11pub trait CodeCache: Send + Sync {
12 fn get_sync(
13 &self,
14 specifier: &ModuleSpecifier,
15 code_cache_type: CodeCacheType,
16 source_hash: u64,
17 ) -> Option<Vec<u8>>;
18
19 fn set_sync(
20 &self,
21 specifier: ModuleSpecifier,
22 code_cache_type: CodeCacheType,
23 source_hash: u64,
24 data: &[u8],
25 );
26}