Create and manage caches with Rapid Cache
Stay organized with collections
Save and categorize content based on your preferences.
You can create and manage cache instances with Rapid Cache to reduce
latency and optimize data access for objects stored in Cloud Storage. This
caching solution helps improve the performance of your applications by
accelerating data retrieval.
This page shows you how to create and manage cache instances with
Rapid Cache. For information on how to use and manage long-running
operations that get initiated from Rapid Cache
asynchronous cache operations, see Use long-running operations.
To get the permissions that
you need to create and manage Rapid Cache caches,
ask your administrator to grant you the
Storage Admin (roles/storage.admin) IAM role on the bucket for which you want to create caches.
This predefined role contains
the permissions required to create and manage Rapid Cache caches. To see the exact permissions that are
required, expand the Required permissions section:
Required permissions
The following permissions are required to create and manage Rapid Cache caches:
storage.anywhereCaches.create (required for creating caches)
storage.anywhereCaches.disable (required for disabling caches)
storage.anywhereCaches.get (required for getting caches)
storage.anywhereCaches.list (required for listing caches)
storage.anywhereCaches.resume (required for resuming caches)
storage.anywhereCaches.update (required for updating caches)
You can also get these permissions with custom roles.
In the list of buckets, click the name of the bucket for which you want
to cache data.
On the Bucket details page, click the Configuration tab.
In the Anywhere Cache section, click Configure cache.
The Configure cache page appears for your bucket.
In the Cache regions section, click the region that contains the
zones in which you want to create a cache.
In the Cache zones section, select the zones in which you want to
create a cache. For each zone you select, set a Time to Live (TTL)
and a data ingestion criteria.
To set a TTL: in the Time to live column, enter a duration in
the Duration* field and select a time unit.
To set the data ingestion criteria: in the Ingestion criteria
column, click editEdit.
In the Set ingestion criteria panel that appears, select a data
ingestion option and click Done.
Click Save.
In the dialog that appears, click Confirm.
The Operations tab in the Bucket details page opens, which shows
you the job status of your create cache operation.
To create a cache as part of creating a new bucket, follow the instructions
in Create a new bucket.
To view the status of a bucket's cache from the Buckets list page:
In the Google Cloud console, go to the Cloud Storage Buckets page.
BUCKET_NAME with the name of the bucket for
which you want to cache data. For example, my-bucket.
CACHE_ZONE with the zone in which the
cache will run. For example, us-east1-b.
To create multiple caches at once, you can specify multiple zones. For
example, us-east1-b us-east1-c us-east1-d.
TTL (optional) with the time to live (TTL) of the
data in the cache. The value can be between 1 day and 7 days, inclusive.
The value can be expressed in seconds, minutes, hours, and days. For
example:
86400s for 86,400 seconds
1440m for 1,440 minutes
24h for 24 hours
1d for 1 day
If unspecified, defaults to 86400s (1 day).
To configure the cache to ingest data the moment the data is written to
the bucket, specify the --enable-ingest-on-write flag.
If successful, the command returns the ID of the long-running operation
associated with the AnywhereCache Create operation. You
can get details about the long-running operation or cancel
the long-running operation to stop the AnywhereCaches Create operation
before it completes.
namespacestoragecontrol=google::cloud::storagecontrol_v2;[](storagecontrol::StorageControlClientclient,std::stringconst&bucket_name,std::stringconst&cache_name,std::stringconst&zone_name){google::storage::control::v2::AnywhereCachecache;cache.set_name(cache_name);cache.set_zone(zone_name);google::storage::control::v2::CreateAnywhereCacheRequestrequest;request.set_parent(std::string{"projects/_/buckets/"}+bucket_name);*request.mutable_anywhere_cache()=cache;// Start a create operation and block until it completes. Real applications// may want to setup a callback, wait on a coroutine, or poll until it// completes.autoanywhere_cache=client.CreateAnywhereCache(request).get();if(!anywhere_cache)throwstd::move(anywhere_cache).status();std::cout << "Created anywhere cache: " << anywhere_cache->name() << "\n";}
importcom.google.api.gax.longrunning.OperationFuture;importcom.google.storage.control.v2.AnywhereCache;importcom.google.storage.control.v2.BucketName;importcom.google.storage.control.v2.CreateAnywhereCacheMetadata;importcom.google.storage.control.v2.CreateAnywhereCacheRequest;importcom.google.storage.control.v2.StorageControlClient;importjava.io.IOException;importjava.util.concurrent.ExecutionException;publicfinalclassAnywhereCacheCreate{publicstaticvoidanywhereCacheCreate(StringbucketName,StringcacheName,StringzoneName)throwsInterruptedException,ExecutionException,IOException{try(StorageControlClientstorageControl=StorageControlClient.create()){CreateAnywhereCacheRequestrequest=CreateAnywhereCacheRequest.newBuilder()// Set project to "_" to signify globally scoped bucket.setParent(BucketName.format("_",bucketName)).setAnywhereCache(AnywhereCache.newBuilder().setName(cacheName).setZone(zoneName).build()).build();// Start a long-running operation (LRO).OperationFuture<AnywhereCache,CreateAnywhereCacheMetadata>operation=storageControl.createAnywhereCacheAsync(request);// Await the LROs completion.AnywhereCacheanywhereCache=operation.get();System.out.printf("Created anywhere cache: %s%n",anywhereCache.getName());}}}
JSON_FILE_NAME with the name of the JSON
file you created in Step 2.
BUCKET_NAME with the name of the bucket
for which you want to cache data. For example, my-bucket.
If successful, the operation returns a google.longrunning.Operation.
You can get details about the long-running operation or
cancel the long-running operation to stop the AnywhereCaches
Create operation before it completes.
View a cache
Console
In the Google Cloud console, go to the Cloud Storage Buckets page.
You can optionally use the --raw flag to return a raw API response
instead of a standardized response. For more information about
controlling listing behaviors, such as paginating results, see the
gcloud storage ls documentation.
CACHE_ID with the identifier of the cache
instance, formulated as
BUCKET_NAME/CACHE_ZONE. For
example, my-bucket/us-east1-b.
To update multiple caches at once, you can specify multiple
identifiers. For example,
my-bucket/us-east1-b my-bucket/us-east1-c.
TTL (optional) with the time to live (TTL) of the
data in the cache. The value can be between 1 day and 7 days, inclusive.
The value can be expressed in seconds, minutes, hours, and days. For
example:
86400s for 86,400 seconds
1440m for 1,440 minutes
24h for 24 hours
1d for 1 day
To configure the cache to ingest data the moment the data is written to
the bucket, specify the --enable-ingest-on-write flag. To
disable ingesting data on write, specify the
--no-enable-ingest-on-write flag.
If successful, the command returns the ID of the raw long-running
operation associated with the AnywhereCache Update operation. You
can get details about the long-running operation.
namespacestoragecontrol=google::cloud::storagecontrol_v2;[](storagecontrol::StorageControlClientclient,std::stringconst&cache_name){google::storage::control::v2::AnywhereCachecache;google::protobuf::FieldMaskfield_mask;field_mask.add_paths("ttl");cache.set_name(cache_name);cache.mutable_ttl()->set_seconds(86400);// Start an update operation and block until it completes. Real applications// may want to setup a callback, wait on a coroutine, or poll until it// completes.autoanywhere_cache=client.UpdateAnywhereCache(cache,field_mask).get();if(!anywhere_cache)throwstd::move(anywhere_cache).status();std::cout << "Updated anywhere cache: " << anywhere_cache->name() << "\n";}
The Cloud Storage portion of the Google Cloud console provides
monitoring charts that let you track the performance of your caches using
metrics. These monitoring charts can also be viewed using
Cloud Monitoring.
Available charts
Chart
Resource hierarchy level
Description
Byte eviction rate
Bucket
The rate of bytes evicted from the cache, sampled every hour. This
data is refreshed more than once an hour to allow time for post processing
the data.
Byte eviction rate
Project
The rate of bytes evicted from all the caches of a bucket, sampled
every hour. This data is refreshed more than once an hour to allow time
for post processing the data.
Bytes in cache
Bucket
The number of the bytes in the cache, sampled every hour. This data is
refreshed more than once an hour to allow time for post processing the
data.
Bytes in cache
Project
The number of bytes in all the caches of a bucket, sampled every hour.
This data is refreshed more than once an hour to allow time for post
processing the data.
Cache throughput benefit
Project
The rate of the data transfer bandwidth quota for the region,
dual-region, or multi-region, usage of the quota, and extra throughput
served by the cache. The extra throughput served by the cache doesn't
count towards the quota, therefore, using the cache enables projects to
exceed the throughput allowed by the quota.
Hit rate operations
Bucket
The percentage of cache operations serving the requested data
from the cache relative to the total cache eligible operations, sampled
every 60 seconds. If a read is completely returned from cache the
operation counts as a hit. If the read is not returned from the cache or
only partially returned from the cache, the operation counts as a
miss.
Hit rate operations
Project
The percentage of cache operations serving the requested data
from all caches for a bucket relative to the total cache eligible
operations, sampled 60 seconds. If a read is completely returned from
cache, the operation counts as a hit. If the read is not returned from
the cache or only partially returned from the cache, the operation
counts as a miss.
Hit rate bytes
Bucket
The percentage of bytes that are served from the cache relative to
the total cache eligible bytes, sampled every 60 seconds.
Hit rate bytes
Project
The percentage of bytes that are served from all caches for a bucket
relative to the total cache eligible bytes, sampled every 60 seconds.
Ingestion rate raw bytes
Bucket
The rate of raw bytes ingested into each cache, sampled
every 60 seconds. All ingested bytes, including non-billable bytes,
are used in calculating the value of this metric. This metric is reported
in real time.
Ingestion rate raw bytes
Project
The rate of raw bytes ingested into all the caches of a bucket,
sampled every 60 seconds. All ingested bytes, including non-billable
bytes, are used in calculating the value of this metric. This metric is
reported in real time.
Throughput - Cache hit
Bucket
The throughput served from the cache, sampled every 60 seconds.
Throughput - Cache hit
Project
The throughput served from all caches for a bucket, sampled every
60 seconds.
Throughput - Cache miss
Bucket
The throughput that's not served from the
cache, sampled every 60 seconds.
Throughput - Cache miss
Project
The throughput that's not served from any of the caches of a bucket,
sampled every 60 seconds.
Access charts
Monitoring charts capture data either for individual buckets or for all buckets
within a project. The resource hierarchy level that a chart captures determines
where you can access the chart.
Access bucket-level charts
In the Google Cloud console, go to the Cloud Storage Buckets page.
In the Cloud Storage navigation pane, click Monitoring.
In the menu bar, click Rapid Cache.
Monitoring charts are displayed.
Use long-running operations
When successfully run, the AnywhereCaches Create and Update operations
initiate a long-running operation. You can get and list long-running
operations in order to view the details and status of the underlying
AnywhereCaches operation, or cancel a long-running operation in order to
cancel the underlying AnywhereCaches operation while it's in progress.
Asynchronous AnywhereCaches APIs are idempotent by default. This means
that you can safely retry asynchronous AnywhereCaches API calls without concern
about modifying resources unintentionally.
For example, say you perform an AnywhereCaches Create operation to create a
cache in us-central1-a, which succeeds. If you perform a subsequent
AnywhereCaches Create operation using the same zone that succeeds, the request
returns the same long-running operation as the previous request. Note that this
behavior only occurs if you include a request_id as part of
your create cache request. If a request_id isn't included, you get an
ANYWHERE_CACHE_ALREADY_EXISTS error when attempting to create a cache that
already exists. For information about how to include a request_id, see
Request identification.
What's next
Get recommendations about which buckets and zones to create a cache for.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-06-09 UTC."],[],[]]