### File

`projects/angular-l10n/src/lib/services/l10n-cache.ts`

### Index

###### Properties

- Private cache

###### Methods

- Public read

### Methods

Public read
`read(key: string, request: Observable<any>)`
Defined in projects/angular-l10n/src/lib/services/l10n-cache.ts:9

Parameters :

Name | Type | Optional
key | `string` | No
request | `Observable<any>` | No

Returns : `Observable<any>`

### Properties

Private cache
Type : `literal type`
Default value : `{}`
Defined in projects/angular-l10n/src/lib/services/l10n-cache.ts:7

    import { Injectable } from '@angular/core';
    import { Observable } from 'rxjs';
    import { shareReplay } from 'rxjs/operators';

    @Injectable() export class L10nCache {

        private cache: { [key: string]: Observable<any> } = {};

        public read(key: string, request: Observable<any>): Observable<any> {
            if (this.cache[key]) return this.cache[key];

            const response = request.pipe(
                shareReplay(1)
            );

            this.cache[key] = response;
            return response;
        }

    }

# result-matching ""

# No results matching ""