SVG framework function: disableCache

This tutorial is part of Iconify SVG Framework functions tutorial.

This function is part of API module and is not available in bundle without API support.

Function disableCache() disables caching in localStorage and sessionStorage.

When SVG framework retrieves new icons from API, icon data is stored in browser storage. Cache makes rendering faster because SVG framework can retrieve icons from cache instead of sending API query. Unlike API queries, cache is instant.

By default, localStorage is enabled, sessionStorage is disabled.

Usage

Function has the following parameter:

  • storage. Storage to disable.

Storage types

First parameter can be one of the following:

  • "local" for localStorage.
  • "session" for sessionStorage.
  • "all" for both localStorage and sessionStorage.

Examples

// Disable caching in localStorage
Iconify.disableCache('local');
// Disable all caching
Iconify.disableCache('all');

Notes

  • Enabling or disabling cache will not affect icon data already stored in cache. Icon data will always be loaded, regardless of setting. Setting affects only storing new icon data retrieved from API.
  • Setting affects only icon data loaded from API. Icon data loaded with addIcon() or addCollection() is not cached.
  • When both localStorage and sessionStorage are enabled, icon data is cached only in localStorage.