In Memory Persistence Strategy

Edit on GitHub

This document explains the In Memory Persistence Strategy service in the Components Library.


In Memory Persistence Strategy is an Angular Service that stores data in memory and will be lost when the browser page is reloaded.

Check out an example usage of the In Memory Persistence Strategy.

Service configuration:

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

Service registration

Register the service:

declare module '@spryker/persistence' {
    interface PersistenceStrategyRegistry {
        'in-memory': InMemoryPersistenceStrategy;

    imports: [
            'in-memory': InMemoryPersistenceStrategy,
export class RootModule {}


Below you can find interfaces for the In Memory Persistence Strategy:

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