1.0.4 • Published 5 years ago

vu-http-cache v1.0.4

Weekly downloads
21
License
-
Repository
-
Last release
5 years ago

VuHttpCache

VuHttpCache is an Angular module created with version 7.1.1 that provides the VuHttpCacheService. It's meant to be a stand-in replacement for the HttpClient service that caches the results of subsequent calls to the same resource per session. Restarting the application will clear all cached results. Alternatively, making a call to the bust(<url>) function will clear the cached item for a specific resource.

Install

npm install vu-http-cache

To Use

In your app.module

import { VuHttpCacheModule, VuHttpCacheService } from 'vu-http-cache';

@NgModule({
    declarations: [
    ],
    imports: [
        VuHttpCacheModule
    ],
    entryComponents: [
    ], 
    providers: [
        VuHttpCacheService
    ]
})
export class AppModule { }

Then from a service with a dependency on HttpClient

import { VuHttpCacheService } from 'vu-http-cache';

@Injectable()
export class SeriousService {

    constructor(private httpCache: VuHttpCacheService) { 
    }

    getSeriousLevels(): Observable<Serious[]> {
        return this.httpCache.get<Serious[]>(`/api/serious`); 
    }

}
1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago