diff --git a/src/api/vps/images/available/vps-images-available.v6.service.js b/src/api/vps/images/available/vps-images-available.v6.service.js index e09432df..9437ccc9 100644 --- a/src/api/vps/images/available/vps-images-available.v6.service.js +++ b/src/api/vps/images/available/vps-images-available.v6.service.js @@ -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; +});