Class CacheManager

public

The CacheManager wraps a Cache enforcing that only the public API surface area is exposed.

Hence, it is the value of Store.cache, wrapping the cache instance returned by Store.createCache.

This class is the the return value of both the recordDataFor function supplied to the store hook instantiateRecord, and the recordDataFor method on the CacheStoreWrapper. It is not directly instantiatable.

It handles translating between cache versions when necessary, for instance when a Store is configured to use both a v1 and a v2 cache depending on some heuristic.

Starting with the v2 spec, the cache is designed such that it must be implemented as a singleton. However, because the v1 spec was not designed for this whenever we encounter any v1 cache we must wrap all caches, even singletons, in non-singleton managers to preserve v1 compatibility.

To avoid this performance penalty being paid by all applications, singleton behavior may be opted-in via the configuration supplied to your Ember application at build time. This effectively removes support for v1 caches.

let app = new EmberApp(defaults, {
  emberData: {
    useSingletonManager: true
  },
});