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

Commit a02bcc7

Browse files
committed
clearCacheMemory() work fine now, per service
1 parent e6b3651 commit a02bcc7

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ts-angular-jsonapi",
3-
"version": "0.6.22",
3+
"version": "0.6.24",
44
"description": "JSONAPI library developed for AngularJS in Typescript",
55
"repository": {
66
"type": "git",

src/library/service.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,10 @@ export class Service extends ParentResourceService implements IService {
307307
}
308308

309309
public clearCacheMemory(): boolean {
310-
return this.getService().cachememory.deprecateCollections(this.type) &&
311-
this.getService().cachestore.deprecateCollections(this.type);
310+
let path = new PathBuilder();
311+
path.applyParams(this);
312+
return this.getService().cachememory.deprecateCollections(path.getForCache()) &&
313+
this.getService().cachestore.deprecateCollections(path.getForCache());
312314
}
313315

314316
public parseFromServer(attributes: IAttributes): void {

src/library/services/cachestore.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ export class CacheStore implements ICacheStore {
108108
);
109109
}
110110

111-
public deprecateCollections(collection_type: string) {
111+
public deprecateCollections(path_start_with: string) {
112112
Core.injectedServices.JsonapiStoreService.deprecateObjectsWithKey(
113-
'collection.' + collection_type
113+
'collection.' + path_start_with
114114
);
115115
return true;
116116
}

src/library/services/path-builder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export class PathBuilder {
66
public includes: Array<string> = [];
77
private get_params: Array<string> = [];
88

9-
public applyParams(service: IService, params: IParamsResource | IParamsCollection) {
9+
public applyParams(service: IService, params: IParamsResource | IParamsCollection = {}) {
1010
this.appendPath(service.getPrePath());
1111
params.beforepath ? this.appendPath(params.beforepath) : null;
1212
this.appendPath(service.getPath());

0 commit comments

Comments
 (0)