Introduction to caching

Skylark has CDN edge caching on all queries, with a default 24 hour TTL. This can be updated using the API, see here. The TTL is set so high by default due to Skylark's advanced cache invalidation features, which are detailed below.

Cache Invalidation

Cache invalidation can happen in a few ways:

  • Manually using the purgeCache mutation. See here.
  • Automatically when a mutation is made.
  • Automatically when an object's availability is starting or ending.

Automatic Invalidation on Mutation

On create or update of an object, all caches that include the object being changed will be invalidated. This includes requests for Sets with the invalidated object in the response and responses where the object is in the relationships. The change will take effect within seconds of the mutation completing.

Automatic Invalidation on Availability

When availability is linked to an object, to ensure the object is only available to the user when it should be, the cache is automatically invalidated at the start and end of the availability.

At the availability start time, an object's type (for example Movie or Episode) will be invalidated. This is so all lists that should contain the object are invalidated.

At the availability end time, only the specific object is invalidated, meaning sets or relationships that don't include that object will remain cached.

Bypassing the cache

It is also possible to completely bypass the cache using the header x-bypass-cache.