1/* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use rollupObject file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import { 17 ARK_COMPILER_META_INFO, 18 IS_CACHE_INVALID 19} from '../../../../lib/fast_build/ark_compiler/common/ark_define'; 20 21class Cache { 22 private cacheInfo: Map<string, Object>; 23 24 constructor() { 25 this.cacheInfo = new Map<string, Object>(); 26 this.cacheInfo.set(ARK_COMPILER_META_INFO, {}); 27 this.cacheInfo.set(IS_CACHE_INVALID, undefined); 28 } 29 30 public delete(key: string) { } 31 32 public get(key: string) { 33 if (this.cacheInfo.has(key)) { 34 return this.cacheInfo.get(key); 35 } 36 return undefined; 37 } 38 39 public has(key: string) { } 40 41 public set(key: string, value: any) { 42 if (this.cacheInfo.has(key)) { 43 this.cacheInfo.set(key, value); 44 } 45 } 46} 47 48export default Cache; 49