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

222
Visualizações
Update / Patch not working in feathersjs app service with feathers-redis-cache used in hooks

I am using feathers-redis-cache in order to cache data for some of the services in my feathersjs app. This is how my hooks look like:

const {hooks: redisCache} = require('feathers-redis-cache');
///... some code ..///
before: {
    all: [],
    find: [validateSearchParams,redisCache.before()],
    get: [redisCache.before()],
    create: [throw400Error('Not supported')],
    update: [throw400Error('Not supported')],
    patch:  [preventAnyUnallowedChanges, redisCache.before()],
    remove: [throw400Error('Not supported')]
  },

  after: {
    all: [],
    find: [removeSensitiveData(), redisCache.after({ expiration: 600 })],
    get: [preventUnallowedConfig, removeSensitiveData(), redisCache.after({expiration: 600 })],
    create: [redisCache.purge()],
    update: [redisCache.purge()],
    patch: [preventUnallowedData, redisCache.purge()],
    remove: [redisCache.purge()]
  },

Now, front end is sending properly formatted data that is getting through GET call (feathersjs get) and after changing and saving data in form, PATCH (feathersjs patch) is returning old, cached data. Once I removed from before hook / patch method redisCache.before(), the patching of the data goes without problem. With that redis method in place and with fetching the data with find and not get, this problem does not exist.

Can somebody explain the reason why patching is not working if data is fetched with get and then patched and it is working when data is fetched with find?

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