Merge branch 'add-cache-entry-delete-api' into bundle-ml-demo
This commit is contained in:
commit
34ff249b57
|
@ -1,11 +1,12 @@
|
|||
import path from 'path';
|
||||
import { readFile, writeFile, existsSync, unlink } from 'promise-fs';
|
||||
import DiskLRUService from '../services/diskLRU';
|
||||
import crypto from 'crypto';
|
||||
import { existsSync, readFile, writeFile, unlink } from 'promise-fs';
|
||||
import path from 'path';
|
||||
import { LimitedCache } from '../types/cache';
|
||||
|
||||
const MAX_CACHE_SIZE = 1000 * 1000 * 1000; // 1GB
|
||||
|
||||
export class DiskCache {
|
||||
export class DiskCache implements LimitedCache {
|
||||
constructor(private cacheBucketDir: string) {}
|
||||
|
||||
async put(cacheKey: string, response: Response): Promise<void> {
|
||||
|
|
5
src/types/cache.ts
Normal file
5
src/types/cache.ts
Normal file
|
@ -0,0 +1,5 @@
|
|||
export interface LimitedCache {
|
||||
match: (key: string) => Promise<Response>;
|
||||
put: (key: string, data: Response) => Promise<void>;
|
||||
delete: (key: string) => Promise<boolean>;
|
||||
}
|
Loading…
Reference in a new issue