Skip to content

Cache option not working #397

@marzack87

Description

@marzack87

Hi,

I'm trying to use typeorm cache using the crud decorator:

@Crud({
  model: {
    type: Order
  },
  query: {
    join: {
      catalog: {
        eager: true
      },
      products: {
        eager: true
      }
    },
    cache: 10000
  }
})

And simple typeorm configuration:

{
  type: 'mysql',
  ...
  cache: true
}

but no cache is created.

Exploring typeorm-crud.service.js code, I've noticed that cache is implemented like this (line 179):

builder.cache(builder.getQueryAndParameters(), options.query.cache);

but in this way the whole SQL query is used as identifier, but its db field is a VARCHAR(255), and so no record is created inside cache's table

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions