Momento
Momento ↗ is a truly serverless caching service. It automatically optimizes, scales, and manages your cache for you.
This integration allows you to connect to Momento from your Worker by getting Momento cache configuration and adding it as secrets to your Worker.
To set up an integration with Momento Cache:
-
You need to have an existing Momento cache to connect to or create a new cache through the Momento console ↗.
-
If you do not have an existing cache, create one and assign
user-profiles
as the cache name. -
Add the Momento database integration to your Worker:
- Log in to the Cloudflare dashboard ↗ and select your account.
- In Account Home, select Workers & Pages.
- In Overview, select your Worker.
- Select Integrations > Momento.
- Follow the setup flow, review and grant permissions needed to add secrets to your Worker.
- Next, connect to Momento.
- Select a preferred region.
- Click Add integration.
-
The following example code show how to set an item in your cache, get it, and return it as a JSON object. The credentials needed to connect to Momento Cache have been automatically added as secrets to your Worker through the integration.
To learn more about Momento, refer to Momento’s official documentation ↗.