Skip to content

Commit cbd9517

Browse files
author
ace-n
committed
Add PSR cache link
1 parent 2a0ea9e commit cbd9517

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

functions/tips_scopes/index.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@ function scopeDemo(ServerRequestInterface $request): string
3333
{
3434
// Heavy computations should be cached between invocations.
3535
// 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
3941
$cachePath = sys_get_temp_dir() . '/cached_value.txt';
4042

4143
if (file_exists($cachePath)) {

0 commit comments

Comments
 (0)