MCPcopy Create free account
hub / github.com/compiler-explorer/compiler-explorer / putWithTTLAndPath

Method putWithTTLAndPath

lib/cache/s3.ts:100–119  ·  view source on GitHub ↗
(
        key: string,
        value: Buffer,
        ttlDays: number,
        pathPrefix: string,
        creator?: string,
    )

Source from the content-addressed store, hash-verified

98 }
99
100 async putWithTTLAndPath(
101 key: string,
102 value: Buffer,
103 ttlDays: number,
104 pathPrefix: string,
105 creator?: string,
106 ): Promise<void> {
107 const expiresDate = new Date(Date.now() + ttlDays * 24 * 60 * 60 * 1000);
108 const options: S3HandlerOptions = {
109 metadata: creator ? {CreatedBy: creator} : {},
110 redundancy: StorageClass.REDUCED_REDUNDANCY,
111 expires: expiresDate,
112 };
113 try {
114 const customPath = `${this.path}/${pathPrefix}`;
115 await this.s3.put(key, value, customPath, options);
116 } catch (e) {
117 this.onError(e, 'write');
118 }
119 }
120}

Callers 1

tempCachePutWithTTLMethod · 0.80

Calls 1

putMethod · 0.65

Tested by

no test coverage detected