File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -33,9 +33,11 @@ function scopeDemo(ServerRequestInterface $request): string
33
33
{
34
34
// Heavy computations should be cached between invocations.
35
35
// The PHP runtime does NOT preserve variables between invocations, so we
36
- // must write their values to a file.
37
- // (All writable directories in Cloud Functions are in-memory, so these
38
- // operations are typically fast.)
36
+ // must write their values to a file or otherwise cache them.
37
+ // (All writable directories in Cloud Functions are in-memory, so
38
+ // file-based caching operations are typically fast.)
39
+ // You can also use PSR-6 caching libraries for this task:
40
+ // https://packagist.org/providers/psr/cache-implementation
39
41
$ cachePath = sys_get_temp_dir () . '/cached_value.txt ' ;
40
42
41
43
if (file_exists ($ cachePath )) {
You can’t perform that action at this time.
0 commit comments