Local Storage Persistence Strategy

Edit on GitHub

This document explains the Local Storage Persistence Strategy service in the Components Library.


Local Storage Persistence Strategy is an Angular Service that uses browser Local Storage to store the data.

Check out an example usage of the Local Storage Persistence Strategy.

Service configuration:

  • storage—persistence strategy type.
        type: 'http',
        cache: {
            storage: 'local-storage',

Service registration

Register the service:

declare module '@spryker/persistence' {
    interface PersistenceStrategyRegistry {
        'local-storage': LocalStoragePersistenceStrategy;

    imports: [
            'local-storage': LocalStoragePersistenceStrategy,
export class RootModule {}


Below you can find interfaces for the Local Storage Persistence Strategy:

interface LocalStoragePersistenceStrategy extends PersistenceStrategy {
    save(key: string, value: unknown): Observable<void>;
    retrieve<T>(key: string): Observable<T | undefined>;
    remove(key: string): Observable<void>;