paygen (api+lib): Add override for cache dir

When executing on a bot we don't mount external cache directories so
instead let's override to a local `.paygen_cache` dir which ends up
inside the bot's named cache and is disposed on overlayfs unmount.

The alternative would be to find a way to _not_ use the cache entirely
which would work for these builders because each request is a single
shot (i.e. no cache hits).

BUG=chromium:1122854
TEST=./run_tests.py

Change-Id: Ifc3c28a7aa25b576b5b715b6de1b1024a4b3de3c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/2519905
Reviewed-by: George Engelbrecht <engeg@google.com>
Reviewed-by: Navil Perez <navil@google.com>
Commit-Queue: George Engelbrecht <engeg@google.com>
Tested-by: George Engelbrecht <engeg@google.com>
diff --git a/api/controller/payload.py b/api/controller/payload.py
index 8b9d223..4e36742 100644
--- a/api/controller/payload.py
+++ b/api/controller/payload.py
@@ -19,6 +19,7 @@
                       ('full_update', 'tgt_unsigned_image'),
                       ('full_update', 'tgt_signed_image'))
 
+_DEFAULT_PAYGEN_CACHE_DIR = '.paygen_cache'
 
 # We have more fields we might validate however, they're either
 # 'oneof' or allowed to be the empty value by design. If @validate
@@ -77,7 +78,8 @@
   # we're still involved in config we'll keep it before the validate_only.
   payload_config = payload.PayloadConfig(tgt_image, src_image,
                                          destination_bucket, input_proto.verify,
-                                         keyset, upload)
+                                         keyset, upload,
+                                         cache_dir=_DEFAULT_PAYGEN_CACHE_DIR)
 
   # If configured for validation only we're done here.
   if config.validate_only: