Skip to main content
menu-icon.png

 

x
Optimizely Knowledge Base

Project Settings: Cache Expiration (TTL)

relevant products:
  • Optimizely X Web Experimentation
  • Optimizely X Web Personalization
  • Optimizely X Web Recommendations
  • Optimizely Classic

THIS ARTICLE WILL HELP YOU:
  • Adjust site performance by changing the snippet's cache time

When visitors land on your site, they need to download all the code that runs on your site, including the Optimizely snippet. The more code, the longer it takes. Caching helps avoid long download times by storing your site's code after the first time visitors download it. Then, on the next page they visit, they don't need to download anything.

The benefit of caching is better site performance. The downside is that if your snippet changes, visitors won't see your latest update because they're running the older cached copy of your site.

To compromise, Optimizely privacy settings for web projects include the Cache Expiration (TTL) feature. Use this feature to customize how long the snippet is cached before visitors' browsers check for new content—the snippet's "time-to-live" (TTL).

If you are still transitioning from Classic to X, you can take advantage of this feature even before you've completed the transition process. This setting applies regardless of how your snippet is configured.

Here's where to find the Cache Expiration (TTL) feature, with detailed steps to follow:

ttl.gif

  1. Navigate to Settings > Implementation.

  2. Click the name of the snippet whose settings you want to change.

  3. Scroll down to Cache Expiration (TTL).
    The default setting is 2 minutes, but you can choose options from no cache up to 60 minutes.

  4. Click Save.

Longer cache times are better for performance, but visitors won't see updates you make to the snippet until the cache expires. If you choose 15 minutes or longer, you'll see a warning that visitors won't see updates until cache expires, which means that an experiment could still run for up to 60 minutes after you stop it.

Cache Expiration (TTL) for custom snippets

If you link multiple projects to create a custom snippet, Optimizely enforces the cache TTL you set for the custom snippet. In other words, the custom snippet's cache TTL trumps the cache TTLs for the individual projects' snippets.