MARKETPLACE
PLUGINS
OPTICACHE (PRO)
OptiCache (Pro) logo

OptiCache (Pro)

Published April 2026
   •    Updated this month

Plugin details

Welcome to OptiCache PRO! ⚡ The ultimate intelligent memory manager for your Bubble app.
Why spend expensive Workload Units (WUs) fetching the exact same data from your database on every single page load? OptiCache transforms the user's browser into a lightning-fast, zero-latency database using localStorage and sessionStorage.

While the Free version gives you basic storage, OptiCache PRO introduces "Smart Caching"—allowing your data to manage its own lifecycle securely.

💎 Features:

⏱️ Smart TTL (Time-To-Live): Set an expiration time (e.g., 60 minutes). The plugin will automatically destroy the cached data when the time is up, forcing a fresh database read. No more "zombie data"!

🔒 User ID Isolation: Prevent cross-contamination! Automatically scope cached keys to the specific logged-in user. If User A and User B share the same PC, their cached data will never mix.

🗂️ Session vs. Local Storage: Choose between Local (data survives browser restarts) and Session (data is automatically wiped the moment the user closes the tab—perfect for sensitive temporary data or tokens).

🧠 Set Server Cache: Save any text or complex JSON to your Upstash Redis database with an optional Time-to-Live (TTL).

⚡ Get Server Cache: Retrieve data globally across any user session in milliseconds.

🗑️ Invalidate Server Cache: Instantly delete specific keys from the server when your core Bubble data changes, forcing a fresh update.

💰 Massive WU Savings: Bypass Bubble's database entirely for frequently accessed public data. Provide an Enterprise-grade, blazing-fast experience at a fraction of the cost!


✨ Key Features in V3:

🌍 Multi-Layer Hybrid Cache (L1 ➔ L2 ➔ L3): Stop guessing where to store data. The new Hybrid Engine checks ultra-fast RAM (Session), falls back to Disk (Local), and if completely missing, securely delegates to your Server (Upstash Redis). Once retrieved, it automatically promotes the data back up the chain for 1ms subsequent loads.

🔄 Stale-While-Revalidate (SWR): The holy grail of web performance. If a cache expires, Opticache will instantly render the stale data (zero blank screens or loaders) while silently triggering a background refresh event to fetch fresh data from your API.

🔑 Invalidation Trees & Versioning: True cache governance. Keys are now structured as [namespace]:[version]:[user_id]:[key]. Instantly wipe entire branches of data (e.g., all "dashboard" data) without touching user "settings", or simply bump the version number to deprecate old cache seamlessly.

📊 WU Savings Analytics: Prove your ROI. Opticache now tracks every single Cache Hit and Miss locally, calculating your Hit Rate % and multiplying it by your custom WU cost per API call to show you exactly how many Workload Units the plugin is saving you in real-time.

Demo Page: https://demo-app-56978.bubbleapps.io/version-test/opticache_pro/1777377651728x447382367620682300

Editor Page: https://bubble.io/page?id=demo-app-56978&test_plugin=1777372940552x924836201410854900_current&tab=Design&name=opticache_pro

$15

One time  •  Or  $5/mo

stars   •   0 ratings
0 installs  
This plugin does not collect or track your personal data.

Platform

Web

Contributor details

NoCoddo logo
NoCoddo
Joined 2025   •   94 Plugins
View contributor profile

Instructions

📖 Full Instructions
1. Setup the Smart Element
Drag the OptiCache PRO Controller element onto your page (we recommend placing it inside a reusable header so it's everywhere). This element is invisible.

2. Saving Data (Set Smart Cache)
Use the element action Set Smart Cache.

Define a key_name (e.g., "dashboard_stats").

Provide the value_text (your text or stringified JSON).

PRO Tip: Set ttl_minutes to 60 so the data expires in an hour, and map user_id to Current User's Unique ID to keep the cache private!

3. Reading Data (Get Smart Cache)
Run the element action Get Smart Cache.

CRUCIAL: Because frontend actions are instant, you must use the element's event "OptiCache PRO Controller - Cache Loaded" to trigger the rest of your workflow.

Once that event fires, check Result of step's is_found to see if the cache is still valid. If yes, display the cached_value! If no (or if the TTL expired), run your standard Bubble DB Search.


How to setup your Global Server Cache:

Create a free account at Upstash (upstash.com) and navigate to the Redis section.

Click + Create Database, give it a name, and choose the region closest to your users.

Once created, scroll down to the REST API section to find your UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN.

How to Save Data to the Server:

In your backend or frontend workflow, select the Set Server Cache action.

Paste your Upstash REST URL and Token.

Define a cache_key (e.g., "pricing_tiers") and the cache_value (text or JSON).

(Optional) Set a ttl_seconds if you want the cache to auto-delete after a certain time (e.g., 3600 for 1 hour).

How to Retrieve Data from the Server:

Use the Get Server Cache action.

Provide your credentials and the cache_key you want to retrieve.

Use the returned cached_value in your next workflow steps!

How to Clear Server Cache:

When your main database updates (e.g., you changed a product price), use the Invalidate Server Cache action with the specific cache_key to instantly clear the old data globally.


📚 How to Setup the "Get Hybrid Cache" Workflow (L1 ➔ L2 ➔ L3)
The Get Hybrid Cache action is the crown jewel of Opticache Pro V3. It acts as an intelligent retriever that scans ultra-fast browser memory (L1/L2) and securely delegates to your backend (L3 - Redis) ONLY if the data is missing.

Because we prioritize strict Enterprise security, Client-Side actions should never hold your private API keys. Instead, we use the Delegation Pattern. Here is exactly how to set it up in your Bubble app:

Step 1: Trigger the Hybrid Cache Search
When a user loads a page or clicks a button, you need to tell Opticache to start searching for the data.

Create a Workflow (e.g., When Page is Loaded or When Button is clicked).

Add the action: Opticache - Get Hybrid Cache.

Fill in the fields:

Key Name: The specific data key (e.g., dashboard_stats).

Namespace: Group your cache (e.g., dashboard).

Version: Your app version (e.g., v1).

Enable SWR: Set to yes if you want instant stale-data loading (explained in Step 3).

Behind the scenes: The plugin will instantly check L1 (Session Storage) and L2 (Local Storage). If the data is there, it publishes the cached_value state instantly in 1ms!

Step 2: Set up the "L3 Fetch Required" Workflow (Secure Delegation)
If the data is NOT found in the browser (or if it's the user's first time visiting), the plugin will "raise its hand" and trigger a specific Bubble event to ask your secure backend for help.

Go to your Workflow tab and add a new event: Elements ➔ An Opticache - L3 Fetch Required.

Action 1 (Fetch Securely): Inside this workflow, run your Server-Side action: Opticache - Get Server Cache (Upstash). Fill in your secure REST URL, Token, and the exact same Key Name.

Action 2 (The Inverse Cascade): Now that your server has securely retrieved the data, we need to push it down to the user's browser so it loads in 1ms next time. Add the Client-Side action: Opticache - Set Smart Cache.

Key Name: The exact same key.

Value Text: Result of step 1's cached_value.

Storage Type: Local (The engine will automatically promote it to Session/L1 as well).

Step 3: Handle Background Revalidation (Stale-While-Revalidate)
If you set Enable SWR = yes in Step 1, the plugin will behave magically when a cache expires. Instead of showing an empty screen, it will immediately display the expired data to the user, and then ask the server for fresh data.

Add a new event: Elements ➔ An Opticache - Background Revalidation Required.

Build the exact same workflow as Step 2:

Run the Server-Side Get Server Cache.

Run the Client-Side Set Smart Cache to inject the fresh data.

(Optional UI Trick): You can show a tiny spinning ↻ icon somewhere on your screen while this workflow runs, and hide it when the Set Smart Cache action finishes. The user's screen will seamlessly update with fresh numbers without ever freezing!

Types

This plugin can be found under the following types:
Element   •   Event   •   Action

Categories

This plugin can be found under the following categories:
Technical   •   Productivity   •   Data (things)   •   Visual Elements

Resources

Support contact
Tutorial

Rating and reviews

No reviews yet

This plugin has not received any reviews.
Bubble