Newer Version Available

This content describes an older version of this product. View Latest

Caching with Storage Service

The Storage Service provides a powerful, simple-to-use caching infrastructure that enhances the user experience on the client. Client applications can benefit from caching data to reduce response times of pages by storing and accessing data locally rather than requesting data from the server. Caching is especially beneficial for high-performance, mostly connected applications operating over high latency connections, such as 3G networks.

The Storage Service supports several implementations of storage and selects one at runtime based on browser support and specified characteristics of persistence and security. Storage can be persistent and secure. With persistent storage, cached data is preserved between user sessions in the browser. With secure storage, cached data is encrypted.

Storage Adapter Name Persistent Secure
SmartStore true true
IndexedDB true false
MemoryAdapter false true
SmartStore
(Persistent and secure) Provides a caching service that is only available for apps built with the Salesforce Mobile SDK. The Salesforce Mobile SDK enables developing mobile applications that integrate with Salesforce. You can use SmartStore with these mobile applications for caching data.
IndexedDB
(Persistent but not secure) Provides access to an API for client-side storage and search of structured data. For more information, see the Indexed Database API.
MemoryAdapter
(Not persistent but secure) Provides access to JavaScript memory for caching data. The stored cache persists only per browser page. Browsing to a new page resets the cache.

The Storage Service selects a storage adapter on your behalf that matches the persistent and secure options you specify when initializing the service. For example, if you request a persistent and insecure storage service, the Storage Service returns the IndexedDB storage if the browser supports it.

To ensure data security, if you request secure storage, the Storage Service always selects a secure adapter even if it doesn’t satisfy the request for persistence. For example, persistent and secure storage is only available for custom apps built with the Salesforce Mobile SDK. If you request persistent and secure storage for an app that's not built with the Salesforce Mobile SDK, the Storage Service returns the MemoryAdapter storage, which is secure but not persistent.

Server-side actions storage is the only currently supported type of storage. Storage for server-side actions caches action response values. The storage name must be actions.

Note