---
name: bijection-action-cache
description: "Evaluate and integrate the Action Cache component with Bijection."
---

# Action Cache

Expensive computation caching

- Package: @bijectionhq/action-cache
- Category: Database & Backend
- Status: Preview
- License: Apache-2.0
- Bijection source (repository access required): https://github.com/bijectionhq/action-cache/tree/9eeb5ad93e1d86f60abc00ef8fda23a67bc370d2
- Upstream: https://github.com/convex/action-cache/tree/ea75a979352847a73900d5496de434b691ec1a04
- Documentation: https://docs.bijection.com/components/using
- Directory: https://bijection.com/components/action-cache

## Get the source

Bijection repository access is required. Request access at https://bijection.com/contact.

```sh
git clone https://github.com/bijectionhq/action-cache.git
cd action-cache
git checkout 9eeb5ad93e1d86f60abc00ef8fda23a67bc370d2
```

## Before using this component

Read the package README at the recorded revision for setup, dependencies, and API examples. Upstream documentation describes the original package and may differ from the Bijection adaptation. This is a source candidate for evaluation. Catalog inclusion does not establish npm availability or runtime qualification. Check compatibility with your SDK and deployment before adoption. External providers run their own compute.

## Integration workflow

1. Read the source README and package manifest at the recorded revision.
2. Confirm the required SDK, dependency availability, and runtime compatibility.
3. Follow the component's documented setup and configuration. Never invent an npm install command from a catalog package name.
4. Keep credentials in the project's existing secret store.
5. Follow the project's execution rules for verification and report what was actually checked.

## Original upstream skill

The following guidance describes @convex-dev/action-cache. Its installation commands and APIs refer to the upstream package. Evaluate compatibility with the Bijection source separately.


> Agents: read this skill fully before writing code that uses Action Cache. Follow the installation and configuration steps exactly.

# Action Cache

## Instructions

Action Cache stores the results of expensive Convex actions like third-party API calls and AI operations in a persistent cache with configurable TTL expiration. The cache automatically handles cleanup through daily cron jobs and uses the action name plus arguments as the cache key. It prevents redundant API calls and reduces costs for operations like OpenAI embeddings, slow database queries, or external service requests.

### Installation

```bash
npm install @convex-dev/action-cache
```

Current npm version: `@convex-dev/action-cache@0.3.1`

## Use cases

- Cache OpenAI embedding calculations for vector search to reduce API costs and latency on repeated queries
- Store responses from slow third-party APIs like weather services, payment processors, or analytics platforms
- Cache expensive data transformations or machine learning inference results that don't change frequently
- Reduce redundant calls to rate-limited external services by persisting successful responses
- Store computed results from complex business logic that involves multiple external API calls

## How it works

The component installs as a Convex component using `app.use()` in your `convex.config.ts` file. You create an `ActionCache` instance that wraps an existing internal action, specifying the action reference, an optional name for cache versioning, and TTL in milliseconds.

Calling `cache.fetch(ctx, args)` first checks for cached results using the action name and arguments as the key. On cache miss, it executes the wrapped action and stores the result. The `force` option bypasses the cache to update stale entries, useful for cron-based cache warming.

Cache management includes `remove()` for single entries, `removeAllForName()` for clearing a specific cache version, and `removeAll()` for complete cleanup. Expired entries are automatically deleted during retrieval and via daily background jobs.

## When NOT to use

- When a simpler built-in solution exists for your specific use case
- If you are not using Convex as your backend
- When the functionality provided by Action Cache is not needed

## Resources

- [npm package](https://www.npmjs.com/package/%40convex-dev%2Faction-cache)
- [GitHub repository](https://github.com/get-convex/action-cache)
- [Convex Components Directory](https://www.convex.dev/components/action-cache)
- [Convex documentation](https://docs.convex.dev)