vu-http-cache
v1.0.4
Published
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
Downloads
4
Readme
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`);
}
}