Skip to content
This repository has been archived by the owner on Apr 3, 2023. It is now read-only.

Commit

Permalink
fix(vps): add cache for available images queries
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyDec committed Sep 26, 2019
1 parent 2a2c3e0 commit 5e2acc4
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions src/api/vps/images/available/vps-images-available.v6.service.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
angular.module('ovh-api-services').service('OvhApiVpsImagesAvailableV6', $resource => $resource('/vps/:serviceName/images/available', {
serviceName: '@serviceName',
}, {
query: { method: 'GET', isArray: true },
get: { method: 'GET', url: '/vps/:serviceName/images/available/:id' },
}));
angular.module('ovh-api-services').service('OvhApiVpsImagesAvailableV6', ($cacheFactory, $resource) => {
const cache = $cacheFactory('OvhApiVpsImagesAvailableV6');
const queryCache = $cacheFactory('OvhApiVpsImagesAvailableV6');

const resource = $resource('/vps/:serviceName/images/available', {
serviceName: '@serviceName',
}, {
query: { method: 'GET', isArray: true, cache: queryCache },
get: { method: 'GET', url: '/vps/:serviceName/images/available/:id', cache },
});

resource.resetCache = () => {
cache.removeAll();
queryCache.removeAll();
};

return resource;
});

0 comments on commit 5e2acc4

Please sign in to comment.