Powered by Upstash

Introduction

Laravel Cloud allows you to create Redis-compatible key-value stores and attach them to your application’s environments directly from the Laravel Cloud dashboard.

Laravel KV stores serve multiple purposes within your Laravel application. They can function as your application’s cache, a backend for storing queued jobs, or for managing sessions. Additionally, you have the option to interact directly with the key-value store by utilizing the Redis API.

Creating a KV Store

To attach a Laravel KV store to an environment, click “Add cache” on your environment’s infrastructure canvas dashboard. When adding a cache to an environment, Laravel Cloud will prompt you to select the cache you would like to attach to the environment or to create a new cache. When creating a new cache, select “Laravel KV Store” as your cache type.

Once the cache has been attached to an environment, you will need to re-deploy the environment in order for the changes to take effect.

Visit the pricing docs for information on sizes, prices, and limits on max connections, data transfer, and command throughput.

Connecting to KV Stores

From Your Application

When a cache is attached to an environment, Laravel Cloud will automatically inject the environment variables needed by the Laravel application to interact with the cache via the Cache facade, including the CACHE_STORE, REDIS_HOST, and REDIS_PASSWORD variables. You may view these environment variables in your environment’s General Settings.

From Your Local Machine

To connect to your Redis-compatible KV store from your local machine using a database management client like TablePlus, click the ”…” icon next to the database card in your environment’s infrastructure canvas dashboard, then click “View credentials”.

The cache credentials modal window will provide you with the credentials needed to connect to your cache, in addition to a “DeepLink” which will open your database in your local machine’s default Redis-compatible database management client if you have one installed.

Editing and Resizing KV Stores

You may edit and resize a Laravel KV store via your organization’s “Resources” page. From the “Resources” page, navigate to the “Caches” tab and click the ”…” icon for the KV store you would like to edit or resize. Then, click “Edit settings”.

KV Store Metrics

You may view metrics such as throughput and hit / miss ratio for Laravel KV stores via your organization’s “Resources” page. From the “Resources” page, navigate to the “Caches” tab and click the ”…” icon for an available KV store. Then, click “View metrics”.

Auto-Upgrade

KV stores have hard limits on monthly data transfer and usage thresholds such as simultaneous connections, commands per second, record size, and request size. When these limits are reached, the KV store may experience performance degradation or stop accepting new requests.

Laravel Cloud offers an automatic upgrade feature for KV stores, ensuring your cache continues to operate smoothly as your usage grows. This feature is available when creating or editing a cache, and can be enabled or disabled at any time.

Enabling Auto-Upgrade

  • When creating a new cache, you will see an option to automatically upgrade a cache. Simply enable this option during setup.
  • You can also enable or disable auto-upgrade for an existing cache from the cache settings page.

How Auto-Upgrades Work

  1. Provisioning & Configuration: When you create or update a cache with auto-upgrade enabled, Laravel Cloud provisions the cache and configures its auto-upgrade settings.
  2. Monitoring: Laravel Cloud continuously monitors your cache’s bandwidth and usage. If your cache approaches its usage or bandwidth limits, the system prepares to upgrade.
  3. Notifications: When a threshold is reached or an upgrade is triggered, Laravel Cloud will send an alert notification to Slack, etc.
  4. Seamless Upgrade: The upgrade is performed automatically in the background, with no downtime for your application. Your cache is moved to the next available size.

Monitoring Bandwidth Usage

A cache bandwidth usage chart is available on your cache’s metrics page. This chart shows how much bandwidth your cache has used over time, helping you:

  • See if you are approaching your bandwidth or size limits
  • Anticipate when an upgrade might occur
  • Understand your application’s cache usage patterns

What to Expect

  • No Downtime: Auto-upgrades are seamless and require no manual intervention.
  • Billing: After an upgrade, billing is adjusted to reflect the new cache size. See the pricing documentation for details.

If you have any questions about auto upgrades or notifications, please contact support.

Detach KV Stores

If a KV Store is no longer needed in your project, you can detach it from your application canvas.

Detaching a KV store does not delete the store. As KV Stores can be shared across many applications, you cannot directly delete a KV store from your application, only detach it.

KV Stores are billed for their availability, regardless of if they are in use by an application. To permanently delete a KV store, you should visit your organization’s “Resources” page.

Deleting KV Stores

You may delete a Laravel KV store via your organization’s “Resources” page. From the “Resources” page, navigate to the “Caches” tab and click the ”…” icon for the KV store you would like to delete. Then, click “Delete cache”.