mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Sets responseMsToLive to zero in some dataService methods and adds ability to reset the responseMsToLive value in subclasses.
This commit is contained in:
@@ -49,7 +49,10 @@ export abstract class DataService<T extends CacheableObject> {
|
||||
protected abstract notificationsService: NotificationsService;
|
||||
protected abstract http: HttpClient;
|
||||
protected abstract comparator: ChangeAnalyzer<T>;
|
||||
protected resetMsToLive = false;
|
||||
/**
|
||||
* Allows subclasses to reset the response cache time.
|
||||
*/
|
||||
protected resetMsToLive: number;
|
||||
|
||||
public abstract getBrowseEndpoint(options: FindAllOptions, linkPath?: string): Observable<string>
|
||||
|
||||
@@ -132,7 +135,7 @@ export abstract class DataService<T extends CacheableObject> {
|
||||
.subscribe((href: string) => {
|
||||
const request = new FindAllRequest(this.requestService.generateRequestId(), href, options);
|
||||
if (this.resetMsToLive) {
|
||||
request.responseMsToLive = 0;
|
||||
request.responseMsToLive = this.resetMsToLive;
|
||||
}
|
||||
this.requestService.configure(request);
|
||||
});
|
||||
@@ -158,7 +161,7 @@ export abstract class DataService<T extends CacheableObject> {
|
||||
.subscribe((href: string) => {
|
||||
const request = new FindByIDRequest(this.requestService.generateRequestId(), href, id);
|
||||
if (this.resetMsToLive) {
|
||||
request.responseMsToLive = 0;
|
||||
request.responseMsToLive = this.resetMsToLive;
|
||||
}
|
||||
this.requestService.configure(request);
|
||||
});
|
||||
@@ -169,7 +172,7 @@ export abstract class DataService<T extends CacheableObject> {
|
||||
findByHref(href: string, options?: HttpOptions): Observable<RemoteData<T>> {
|
||||
const request = new GetRequest(this.requestService.generateRequestId(), href, null, options);
|
||||
if (this.resetMsToLive) {
|
||||
request.responseMsToLive = 0;
|
||||
request.responseMsToLive = this.resetMsToLive;
|
||||
}
|
||||
this.requestService.configure(request);
|
||||
return this.rdbService.buildSingle<T>(href);
|
||||
|
@@ -20,7 +20,7 @@ import { DSOChangeAnalyzer } from '../data/dso-change-analyzer.service';
|
||||
@Injectable()
|
||||
export class WorkflowItemDataService extends DataService<WorkflowItem> {
|
||||
protected linkPath = 'workflowitems';
|
||||
protected resetMsToLive = true;
|
||||
protected resetMsToLive = 0;
|
||||
|
||||
constructor(
|
||||
protected comparator: DSOChangeAnalyzer<WorkflowItem>,
|
||||
|
@@ -20,7 +20,7 @@ import { WorkspaceItem } from './models/workspaceitem.model';
|
||||
@Injectable()
|
||||
export class WorkspaceitemDataService extends DataService<WorkspaceItem> {
|
||||
protected linkPath = 'workspaceitems';
|
||||
protected resetMsToLive = true;
|
||||
protected resetMsToLive = 0;
|
||||
|
||||
constructor(
|
||||
protected comparator: DSOChangeAnalyzer<WorkspaceItem>,
|
||||
|
@@ -22,7 +22,7 @@ import { ProcessTaskResponse } from './models/process-task-response';
|
||||
@Injectable()
|
||||
export class ClaimedTaskDataService extends TasksService<ClaimedTask> {
|
||||
|
||||
protected resetMsToLive = true;
|
||||
protected resetMsToLive = 0;
|
||||
|
||||
/**
|
||||
* The endpoint link name
|
||||
|
@@ -27,7 +27,7 @@ export class PoolTaskDataService extends TasksService<PoolTask> {
|
||||
*/
|
||||
protected linkPath = 'pooltasks';
|
||||
|
||||
protected resetMsToLive = true;
|
||||
protected resetMsToLive = 0;
|
||||
|
||||
/**
|
||||
* Initialize instance variables
|
||||
|
Reference in New Issue
Block a user