Skip to content
This repository has been archived by the owner on Aug 18, 2018. It is now read-only.

Commit

Permalink
clearCacheMemory() work fine now, per service
Browse files Browse the repository at this point in the history
  • Loading branch information
pablorsk committed Jun 5, 2017
1 parent e6b3651 commit a02bcc7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ts-angular-jsonapi",
"version": "0.6.22",
"version": "0.6.24",
"description": "JSONAPI library developed for AngularJS in Typescript",
"repository": {
"type": "git",
Expand Down
6 changes: 4 additions & 2 deletions src/library/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,10 @@ export class Service extends ParentResourceService implements IService {
}

public clearCacheMemory(): boolean {
return this.getService().cachememory.deprecateCollections(this.type) &&
this.getService().cachestore.deprecateCollections(this.type);
let path = new PathBuilder();
path.applyParams(this);
return this.getService().cachememory.deprecateCollections(path.getForCache()) &&
this.getService().cachestore.deprecateCollections(path.getForCache());
}

public parseFromServer(attributes: IAttributes): void {
Expand Down
4 changes: 2 additions & 2 deletions src/library/services/cachestore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ export class CacheStore implements ICacheStore {
);
}

public deprecateCollections(collection_type: string) {
public deprecateCollections(path_start_with: string) {
Core.injectedServices.JsonapiStoreService.deprecateObjectsWithKey(
'collection.' + collection_type
'collection.' + path_start_with
);
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/library/services/path-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export class PathBuilder {
public includes: Array<string> = [];
private get_params: Array<string> = [];

public applyParams(service: IService, params: IParamsResource | IParamsCollection) {
public applyParams(service: IService, params: IParamsResource | IParamsCollection = {}) {
this.appendPath(service.getPrePath());
params.beforepath ? this.appendPath(params.beforepath) : null;
this.appendPath(service.getPath());
Expand Down

0 comments on commit a02bcc7

Please sign in to comment.