Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

160
Visualizações
Vue js: cache for speed up API request

i'm new to Vue js and i created my first project using Node JS APIs and it's working good but a bit slow when multiple request achieve so i created a cache for each API but as i can see it cached data for short period of time and then i need to wait again and when cached it's not really fast, below i created an API.js folder and i stored all my API calls in it.. is there a way to achieve cache best practice in Vue js? thanks in advance

import axios from 'axios'
import { cacheAdapterEnhancer } from 'axios-extensions';

const http = axios.create({
    baseURL: 'https://******.herokuapp.com/',
    headers: { 'Cache-Control': 'no-cache' },
    // cache will be enabled by default
    adapter: cacheAdapterEnhancer(axios.defaults.adapter)
});

class BuildingsService {
    getBuildings(){
          return http.get('buildings/api/');
    }
    getFlats(id){
         return http.get(`flats/api/${id}`);
    }
    notifications(){
          return http.get('notifications/api/');
    }

    getOneBuilding(id){
          return http.get(`buildings/api/${id}`)
    }
   getAllFlats(){
           return http.get(flats/api/')
      }

    


}


export default new BuildingsService();

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda