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..67a79d33 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,26 @@ -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(); + }; + + resource.resetQueryCache = () => { + queryCache.removeAll(); + }; + + resource.resetAllCache = () => { + resource.resetCache(); + resource.resetQueryCache(); + }; + + return resource; +});